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

Attachment: pgpQSLNH7t1uZ.pgp
Description: PGP signature

Reply via email to