Fw: Re: Problem with Tomcat 4.1 Charset - Resolved!

2004-11-04 Thread Mathias Payer
Hi List!

My problem with the appended charset is resolved, thanks to Mark Sutton who
sent me his solution and told me to share it with the list if it worked out!

So after I deinstalled Tomcat 4.1.30 and turned to the new production release
5.0 everyhting worked fine!

And I can definitly say that IE can not cope with 
Content-Type: application/pdf; charset=ISO-8859-1

it looks like it was a bug in the tomcat-server, so thanks for your time and
if somebody else has this problem:
An update helps!

Greats Mathias

Begin forwarded message:

Date: Thu, 4 Nov 2004 13:53:57 +
From: Mark Sutton [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Subject: Re: Problem with Tomcat 4.1  Charset


Hi

I am having problems posting to the list so I thought I would mail you
directly.

I had a similar problem with PDFs and it seemed to be this bug:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24970

that was causing the problem.  I wasn't aware that this was a Windows-only
bug though.  This bug was not present in 4.1.27 and only manifested itself
when I tried 4.1.29.  It doesn't cause problems with version 5.0.x.

If this helps, then you might want to post back to the list.

Mark


- Forwarded by Mark Sutton/LDN/FIMAT on 04/11/2004 13:51 -
 
   Mathias Payer 
 
mathias.payer@   To: Tomcat Users List
[EMAIL PROTECTED]   gmgnet.li
   cc:   
  Subject: Re: Problem with Tomcat 4.1 
Charset 03/11/2004   
  
17:45
   Please respond
  to Tomcat 
 
   Users List   
 
 
 
  




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

Problem with Tomcat 4.1 Charset

2004-11-03 Thread Mathias Payer
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


pgpQSLNH7t1uZ.pgp
Description: PGP signature


Re: Problem with Tomcat 4.1 Charset

2004-11-03 Thread Mathias Payer
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