【发布时间】:2014-11-06 10:36:44
【问题描述】:
当我使用以下代码未经身份验证显示图像时,出现 401 错误.. 如何解决这个错误?
<%
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(Constant.USER, Constant.PASSWORD.toCharArray());
}
});
String url=request.getAttribute("url").toString();
<img alt="" src="<%=url%>" />
我也尝试了以下链接,但询问我有关登录凭据的信息
http://techtipsjava.blogspot.in/2014/04/securing-restful-apis-with-http-basic.html http://www.xyzws.com/javafaq/how-to-add-basic-authentication-into-httpurlconnection/140
如何在没有登录凭据的情况下显示图像??? 谢谢
【问题讨论】:
标签: java liferay liferay-6 alfresco