当我尝试向客户端浏览器发送数据时出现此异常。我使用 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)