我能够生成byte []对象,但在刷新字节时,我得到了
的异常org.apache.catalina.connector.ClientAbortException: java.net.SocketException: Broken pipe
我正在使用Ajax调用servlet
$.ajax({
url: 'CertServlet',
dataType: 'json',
type: 'post',
data: data,
success: function( data, textStatus, jQxhr ){
error: function( jqXhr, textStatus, errorThrown ){
console.log( errorThrown );
}
});
我的servlet代码
byte[] output = null;
try {
output = JasperExportManager.exportReportToPdf(jasperPrint);
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(output); --> This has value
response.reset();
response.resetBuffer();
response.setHeader("Content-Disposition", "inline;filename=Sample.pdf");
response.setContentType("application/pdf");
response.setContentLength(output.length);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
out.write(output,0,output.length);
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
总例外是
rg.apache.catalina.connector.ClientAbortException: java.net.SocketException: Broken pipe
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:410)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:378)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:435)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at
任何想法都出错了?
欣赏信息。
此致