读书人

chrome 来自服务器的响应包含重复标头

发布时间: 2012-06-28 15:20:03 作者: rapoo

chrome 来自服务器的响应包含重复标头。此问题通常是由于网站或代理配置不正确导致的。只有网站或代理管理员才能解决此问题

今天项目中用到了写入流下载。代码如下。

?

HttpServletResponse reponse = super.getResponse();

reponse.setHeader("Content-Disposition", "attachment;filename=" + fileName);

reponse.setContentType("application/octet-stream");

reponse.setBufferSize(2048);

reponse.setContentLength(byteArr.length);

ServletOutputStream out = null;

try {

out = reponse.getOutputStream();

out.write(byteArr, 0, byteArr.length);

} catch (IOException e1) {

// TODO Auto-generated catch block

log.error(e1);

}

?

这段代码在项目中一直运行良好。。近日,有位兄弟,在这里面加入了点点代码。。

导致在 chorme 浏览器中,抛出异常。

?

异常如下

^ (PARSE ERROR)
Test ResultsFF11warn (accepts the unquoted value)FF14warn (accepts the unquoted value)MSIE8warn (accepts the unquoted value)MSIE9warn (accepts the unquoted value)Operawarn (accepts the unquoted value)Safariwarn (treats the comma as delimiter and offers to download "foo.html")Konqpass (ignores thes header field)Chr17pass (reports a network error ("Duplicate headers received from server"))Chr18pass (reports a network error ("Duplicate headers received from server"))

'attachment', specifying a filename of?foo,bar.html?using a comma despite using token syntax.

attwithasciifilenamenqs?[TEST] [R]

?

?

?

?

?

?

读书人网 >Web前端

热点推荐