java.io.IOException:服务器返回HTTP响应代码:401身份验证
当我在没有身份验证的情况下使用以下代码显示图像时,得到了401错误。。 如何解决这个错误java.io.IOException:服务器返回HTTP响应代码:401身份验证,java,liferay,liferay-6,alfresco,Java,Liferay,Liferay 6,Alfresco,当我在没有身份验证的情况下使用以下代码显示图像时,得到了401错误。。 如何解决这个错误 <% Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(Constant.USER, Constant.PASSWORD.toCharArray())
<%
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%>" />
增加两张票并没有多大帮助。如果您有一张Alfresco票证(可能您会使用Alfresco&Liferay的SSO),那么您可以在url中添加票证以检索内容
请看下面的问题: