Struts2 - Https中IE浏览器不能下载的问题

在http中能下载,但是启用https协议后下载报错问题结果,在谷歌,火狐浏览器正常

具体操作如下:

// 获取下载文件
		//userRegisterInfoPath  下载路径
                File downloadFile = new File(userRegisterInfoPath);
		FileInputStream fos = new FileInputStream(downloadFile);
		byte[] bytes = new byte[4096];
		int read = 0;
		response.reset();
		response.setContentType("application/octet-stream;charset=UTF-8");
                //filename 是带扩展名
		response.setHeader("Content-Disposition","attachment; filename="+ URLEncoder.encode("申请表.pdf", "utf-8"));
		response.setHeader("Pragma", "public");
                //下载设置的关键项
		response.setHeader("Cache-Control","public");  
		ServletOutputStream  sos =  response.getOutputStream();
		while((read=fos.read(bytes))!=-1){
		    sos.write(bytes, 0, read);
		}
		sos.flush();
		sos.close();
		   

 

 

你可能感兴趣的:(struts2)