In my java program, It use ByteArrayOutputStream.writeTo(response.getOutputStream()); to create a pdf out put report. When the ByteArrayOutputStream size geting larger, the proccess hang on this step for ever if the jsp page is open from IE, but works well from Google Chrome. If the ByteArrayOutputStream size is not too big. The program works no problem on both IE and Google Chrome. Need help. Thanks in advance.
Um, do you actually mean that the request to produce this PDF is generated by HTML which was generated by a JSP? Your original post sort of suggested that the Java code in question was in the JSP. If it's the former then (of course) the fact that the original HTML was generated by JSP is irrelevant. And it's confusing to point that fact out.
Just in case you didn't already know: A JSP generates HTML (usually) and sends it to the browser as the response to a request. The browser doesn't know or care that a JSP generated the HTML.
Back to your question: IE has a long history of not behaving nicely with PDF downloads. You may want to look at other people's working PDF downloads and inspect the headers to make sure yours are right. And are you sure that the Content-Length header is supposed to have quotes (or apostrophes, or whatever those are) around it like that?
Author and all-around good cowpoke
posted 6 years ago
The java process is called from a jsp page. But after processing the application creates pdf file directly, and not going back to any other jsp page.
Do you mean the JSP generates a link which when clicked creates a request for the pdf and the pdf is generated by a servlet - OR
do you mean that the code for pdf generation and writing to the response output stream is embedded in a JSP?
To make my question simple.
The following Java is the most end of the program. outPut.writeTo(response.getOutputStream()); will directly create an output pdf file.
The program allway works perfectly if the web application run from the browser Google Chrome or Firefox. The pdf is showed up as soon as the step of
The application also works well in most of cases when it running from IE, But when the ByteArrayOutputStream size getting larger, the process could hang on at the step of
outPut.writeTo(response.getOutputStream(); for ever.
Why outPut.writeTo(response.getOutputStream()); runs different from IE and Google Chrome (Firefox)? Anything need to be setup for Respose or ByteArrayOutputStream? What is returned by response.getOutputStream(); ? Is it return different from different browsers? Thanks.