- Caused by: java.net.SocketException: Connection reset by peer: socket write error
- at java.net.SocketOutputStream.socketWrite0(Native Method)
- at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
- at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
- at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:737)
- at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
- at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:299)
- at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:963)
- at org.apache.coyote.Response.action(Response.java:183)
- at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:314)
- ... 26 more
- 2012-12-14 9:22:13 org.apache.catalina.core.StandardWrapperValve invoke
- 严重: Servlet.service() for servlet action threw exception
- java.lang.IllegalStateException: Cannot forward after response has been committed
- at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:302)
- at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
- at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
- at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
- at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
- at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
- at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
- ......................
- 下载代码:
- os = response.getOutputStream();
- is = new FileInputStream(new File("download.wmv"));
- response.reset();
- String fileName = "download.wmv"
- response.setHeader("Content-disposition", "p_w_upload;filename =" + new String(fileName.getBytes("GBK"),"ISO8859-1"));
- int length= 0;
- byte[] buffer = new byte[1024];
- while((length= is.read(buffer,0,1024)) != -1){
- os.write(buffer, 0, length);
- }
- os.flush();
- is.close();
- os.close();
文件下载取消保存下载异常
转载下一篇:ExcelUtil
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
java和vue实现文件下载
java和vue实现文件下载
java vue -
linux 保存下载 rpm 程序包及其所需依赖
repotrack
nginx 服务器 压缩包