当我尝试将数据发送到客户端浏览器时,我收到此异常。我使用apache POI lib生成一个Excel文件,如下例所示:
workbook = generateData();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=" + this.filename);
out = response.getOutputStream();
workbook.write(out);
这适用于少量数据,但每次我尝试使用大量数据时都无法正常工作。应用程序需要30秒以上才能生成数据,这个时间太长了,我可以阻止它吗?
ClientAbortException: java.net.SocketException: Broken pipe
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:369)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:448)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:318)
at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:274)
...
Caused by: java.net.SocketException: Broken pipe
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.jk.common.ChannelSocket.send(ChannelSocket.java:539)
at org.apache.jk.common.JkInputStream.doWrite(JkInputStream.java:162)
at org.apache.coyote.Response.doWrite(Response.java:560)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:364)