As far as i remeber, IE wants to know the content-length to show a PDF.
=> put the appopriate content-length into your Response-Header, ensure to have set the right content-type and i would expect that the PDF-stream should work then for IE, too.


_christoph

I have a problem that just came up.  I have PDF documents located out side
of my webapps directory.
When the user wants one they go to my servlet which streams it back.
This use to work just fine, but now is broke.

In IE I get Error opening document on TC4.1.30 and unable to open this
Internet site in TC 5.0.19

Mozilla 1.6 does not have a problem opening the file.

What is odd is that Mozilla seems to request the servlet twice from one
click, the first tends to throw this
ClientAbortException:  java.net.SocketException: Software caused connection
abort: socket write error
       at
org.apache.coyote.tomcat4.OutputBuffer.realWriteBytes(OutputBuffer.java:410)
       at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:332)
       at
org.apache.coyote.tomcat4.OutputBuffer.writeBytes(OutputBuffer.java:438)
       at
org.apache.coyote.tomcat4.OutputBuffer.write(OutputBuffer.java:425)
       at
org.apache.coyote.tomcat4.CoyoteOutputStream.write(CoyoteOutputStream.java:1
08)
       at GetPDFDoc.outputFile(GetPDFDoc.java:128)
       at GetPDFDoc.processRequest(GetPDFDoc.java:86)
       at GetPDFDoc.doGet(GetPDFDoc.java:147)

Is there anything wrong with what I am doing?
     response.setContentType("application/pdf");
     response.setDateHeader("Expires", 0);
// open pdf outside of browser
     response.addHeader("Content-disposition", "attachment; filename=" +
ntspNo + ".pdf");
     response.setContentLength((int)f.length());
     java.io.OutputStream out = response.getOutputStream();
// f is the pdf on the file system and it does exist
     java.io.FileInputStream in = new java.io.FileInputStream(f);
     int size = 0;
     byte[] buffer = new byte[8192];
     while( (size = in.read(buffer, 0, buffer.length)) != -1)
     {
       out.write(buffer, 0, size);
     }
     in.close();
     out.close();

Thanks






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to