Hi Yoav,
thanks for your suggestion, but I already tried that!
(
esponse.setHeader("Content-disposition","inline;filename=generated.pdf"
); )But this does not work on all browsers! On some IE Versions the adobe-plugin is loaded (you see the splash-screen) and then the page remains white. No PDF and no adobe is displayed! So this does not work either! But if I use content-disposition on the linux-server it works (as it worked without content disposition) I use the exact same files on the exact same data. When I save the files look for the difference the only thing I find is the additional charset= ... on the non working version. Greats Mathias On Wed, 3 Nov 2004 12:34:28 -0500 "Shapira, Yoav" <[EMAIL PROTECTED]> wrote: > > Hi, > You're barking up the wrong (but only slightly wrong) tree. Instead > of messing with the charset stuff, make sure to set a > content-disposition header on your response. Google for it if you're > not sure what it is: it's simple and there are tons of examples > online. This is the only way to ensure somewhat consistent behavior > across browsers for this use-case. > > Yoav Shapira http://www.yoavshapira.com > > > >-----Original Message----- > >From: Mathias Payer [mailto:[EMAIL PROTECTED] > >Sent: Wednesday, November 03, 2004 12:20 PM > >To: [EMAIL PROTECTED] > >Subject: Problem with Tomcat 4.1 & Charset > > > >Hi List! > > > >I've got a big problem to solve. > > > >On a windows server I installed an acutal jsdk and tomcat 4.1. > >Now I developed a jsp-Servlet that sets it's content-type to > >"application/pdf" and only writes pdf-data out. > > > >If I run this on my testserver with tomcat 4.0 (debian/linux) > everything > >runs fine and Internet Explorer is able to open the pdf. > > > >But if I merge to the production server (tomcat 4.1/win 2k3) (<- not > >my choice :) ) and try to acces the exact same page I get a funny > >error! > > > >Internet Explorer tells me to save the file to disc! > > > >It took me a long time to figure out that the only difference is in > >the headers! > > > >=> The Linux Machine wirtes: Content-Type: application/pdf > >=> The Windows Machine wirtes: C ontent-Type: > >application/pdf;charset=ISO-8859-1 > > > >Because of this additional charset Internet Explorer is no longer > >able to start the pdf-Viewer and display the file inline. > > > >Attached are some snips from the code: > > > >--SNIP-- > > // response.setHeader("Content-disposition","inline; > >filename=generated.pdf"); // > response.setHeader("Pragma", > >"no-cache"); // response.setHeader("Cache-Control", "no-cache"); > > // response.setHeader("Cache-Control","no-store" ); > > // response.setDateHeader("Expires", -1); > > // response.setHeader("Content-Type","application/pdf" ); > > response.setContentType( "application/pdf" ); > > --SNAP-- > >This shows some different options I tried -> Somewhere on the web it > was > >mentioned that IE had problems with caches and so on... The second > >last line resulted in two Content-Type headers, but I set the > >Content-Type nowhere else in the JSP! > > > >--SNIP-- > > ByteArrayOutputStream buffer = new ByteArrayOutputStream(); > > ... > > // we output the writer as bytes to the response output > > response.setContentLength(buffer.size()); > > ServletOutputStream output = response.getOutputStream(); > > buffer.writeTo(output); > > output.flush(); > >--SNAP-- > >buffer is my byte-buffer where the raw pdf resides. > > > >Can somebody help me how I can disable or suppress this > >charset-stuff? > > > >Or if you have some ideas, just mention them! > > > >Thanks in advance! > >Greats > >Mathias > > > >-- > >Homepage: http://cgi.ethz.ch/~payerm/ GPG-Keys unter Privat/Kontakt > > > > This e-mail, including any attachments, is a confidential business > communication, and may contain information that is confidential, > proprietary and/or privileged. This e-mail is intended only for the > individual(s) to whom it is addressed, and may not be saved, copied, > printed, disclosed or used by anyone else. If you are not the(an) > intended recipient, please immediately delete this e-mail from your > computer system and notify the sender. Thank you. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Homepage: http://cgi.ethz.ch/~payerm/ GPG-Keys unter Privat/Kontakt
pgpIhMJHHn4bx.pgp
Description: PGP signature
