报错:java.net.SocketException: Socket closed
代码:
String filename = "xxx报表"+TimeUtil.getCurrentTime()+".xls";
try {
filename = new String(filename.getBytes("GBK"), "ISO-8859-1");
} catch (UnsupportedEncodingException e) {
logger.error("下载异常");
}
response.addHeader("Content-Disposition", "attachment;filename="+filename);
response.setContentType("application/octet-stream");
OutputStream outputStream = null;
try {
outputStream = response.getOutputStream();
// wb 是一个excel对象来的,已经有内容
wb.write(outputStream);
outputStream.flush();
outputStream.close();
} catch (IOException e) {
downloadResult = false;
logger.error("下载报表异常:",e);
}finally{……省略……}
婷婷同学_
相关分类