chrome 来自服务器的响应包含重复标头。此问题通常是由于网站或代理配置不正确导致的。只有网站或代理管理员才能解决此问题
错误 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION):我们收到了多个“Content-Disposition”标头。我们不允许此行为,以防遭到 HTTP 响应拆分攻击。”
-------------------------------------------------------------------------------------
代码:
public String downFile(){ inputStream = downloadFile();
return "downFile";
}
public InputStream downloadFile(){
FileInputStream fileInputStream = null; try {
Resourcefile resourcefile = userServiceImpl.findResourcefile(userInfoVo.getResourcefileId());//这个是我从数据库里面去到的一个类,就是资源(Resourcefile)这个类。
/*Resourcefile 分别有filePath fileName等属性
*
*/
System.out.println("下载路径 = "+resourcefile.getFilePath());
File file = new File(resourcefile.getFilePath());
if (file.exists()){System.out.println("文件存在");}
fileInputStream = new FileInputStream(file);
this.fileName = file.getName();
} catch (Exception e){
e.printStackTrace();
}
return fileInputStream;
}
--------------------------------------------------------------------------------
<action name="UserAction*" class="com.myitbbs.action.UserAction" method="{1}">
<exception-mapping result="uploadFail" exception="java.lang.Excption"></exception-mapping> <interceptor-ref name="defaultStack">
</interceptor-ref>
<result name="downFile" type="stream">
<param name="contentType">application/octet-stream;charset=ISO8859-1</param>
<param name="inputName">inputStream</param>
<param name="bufferSize">4096</param>
<param name="contentDisposition">
attachment;filename="${fileName}"
</param>
</result>
</action>struts2文件下载浏览器
错误 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION):我们收到了多个“Content-Disposition”标头。我们不允许此行为,以防遭到 HTTP 响应拆分攻击。”
-------------------------------------------------------------------------------------
代码:
public String downFile(){ inputStream = downloadFile();
return "downFile";
}
public InputStream downloadFile(){
FileInputStream fileInputStream = null; try {
Resourcefile resourcefile = userServiceImpl.findResourcefile(userInfoVo.getResourcefileId());//这个是我从数据库里面去到的一个类,就是资源(Resourcefile)这个类。
/*Resourcefile 分别有filePath fileName等属性
*
*/
System.out.println("下载路径 = "+resourcefile.getFilePath());
File file = new File(resourcefile.getFilePath());
if (file.exists()){System.out.println("文件存在");}
fileInputStream = new FileInputStream(file);
this.fileName = file.getName();
} catch (Exception e){
e.printStackTrace();
}
return fileInputStream;
}
--------------------------------------------------------------------------------
<action name="UserAction*" class="com.myitbbs.action.UserAction" method="{1}">
<exception-mapping result="uploadFail" exception="java.lang.Excption"></exception-mapping> <interceptor-ref name="defaultStack">
</interceptor-ref>
<result name="downFile" type="stream">
<param name="contentType">application/octet-stream;charset=ISO8859-1</param>
<param name="inputName">inputStream</param>
<param name="bufferSize">4096</param>
<param name="contentDisposition">
attachment;filename="${fileName}"
</param>
</result>
</action>struts2文件下载浏览器
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货