Added response.setHeader("Pragma", "cache"); response.setHeader("Cache-Control", "cache");
And now it works. I was not adding the cache-control, something else must have but did not override my setting to cache. Mozilla still double downloads, but then 90% of my users are IE. Thanks. -----Original Message----- From: Sasha Borodin [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 11, 2004 2:23 PM To: Tomcat Users List Subject: Re: Streaming pdf document fails Bert, I just ran across something similar today, read this document: http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com: 80/support/kb/articles/q316/4/31.asp&NoWebContent=1 The way I understand it, IE wants to save the file in cache before letting you view it; if you're requesting something via SSL (https://...) IE actually honors the cache defeating tags, which I noticed you have; hence the error. Removing the... > Pragma: No-cache > Cache-Control: no-cache ...headers should fix your problem, I think. It worked for me, let me know if this words for you too. -Sasha > From: "Summers, Bert W." <[EMAIL PROTECTED]> > Reply-To: Tomcat Users List <[EMAIL PROTECTED]> > Date: Tue, 11 May 2004 12:32:49 -0700 > To: Tomcat Users List <[EMAIL PROTECTED]> > Subject: RE: Streaming pdf document fails > > This is what tcptrace tells me is being sent back to the browser > > HTTP/1.1 200 OK > Pragma: No-cache > Cache-Control: no-cache > Expires: Thu, 01 Jan 1970 00:00:00 GMT > Content-disposition: attachment; filename=N77-NTSP-E-70-0203.pdf > Content-Type: application/pdf > Content-Length: 443928 > Date: Tue, 11 May 2004 19:29:37 GMT > Server: Apache-Coyote/1.1 > > If I remove the Content-disposition then the PDF opens in the browser > ok, but that is not what I want. Secondly Mozilla still asks for the > file twice and gets it, but only displays one of them. > > > -----Original Message----- > From: Christoph Meier [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 11, 2004 12:28 PM > To: Tomcat Users List > Subject: Re: Streaming pdf document fails > > > 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.ja >> va: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] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]