報錯: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{……省略……}
添加回答
舉報
0/150
提交
取消