You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mathias Payer <ma...@gmgnet.li> on 2004/11/05 08:15:32 UTC

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

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 +0000
From: "Mark Sutton" <Ma...@fimat.com>
To: "mathias.payer@gmgnet.li" <ma...@gmgnet.li>
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"
<to...@jakarta.apache.org>                           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" <Yo...@mpi.com> 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:mathias.payer@gmgnet.li]
> >Sent: Wednesday, November 03, 2004 12:20 PM
> >To: tomcat-user@jakarta.apache.org
> >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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


--
Homepage: http://cgi.ethz.ch/~payerm/ GPG-Keys unter Privat/Kontakt
(See attached file: attiaohl.dat)


*******************************************************************
Please note that this email address will be converted from the current
email address to FirstName.LastName@Fimat.com.  You are encouraged
to start using this address for all future communications.    

The e-mail and any attachments are confidential. They may contain
privileged information and are intended for the named addressee(s)
only. If you are not the intended recipient, please notify us
immediately and do not disclose, distribute, or retain this e-mail
or any part of it.

Unless expressly stated, opinions in this e-mail are those of the
individual sender and not of the FIMAT Group. We believe but do not
warrant that this e-mail and any attachments are virus free. 
You must therefore take full responsibility for virus checking. 
The FIMAT Group reserve the right to monitor e-mail communications
through its networks. 

Where this communication constitutes a financial promotion it is issued
and approved by Fimat International Banque S.A. (UK Branch) and is 
only intended for persons of a kind described in article 19(5) of the
Financial Services and Markets Act 2000 (Financial Promotion) Order
2001.  This information is not intended to be distributed to UK "Private
Customers" (as defined by the Financial Services Authority).

Fimat International Banque S.A. (UK Branch) whose registered branch
in England is at SG House, 41 Tower Hill, London EC3N 4SG is authorised
by the Commission Bancaire in France and by the UK Financial Services
Authority; regulated by the Financial Services Authority for the conduct of
UK Business and is entered in the Financial Services Authority's register
(Register Number 183415), access to which can be gained via the following
link: www.fsa.gov.uk/register/

Member and a SETS Participant of the London Stock Exchange ("LSE").
Where this communication is confirming an "on exchange" transaction
(as defined by the LSE),the transaction is subject to the rules of the LSE.
Any information, opinions, estimates and forecasts contained in this 
document have been arrived at or obtained from public sources believed
to be reliable and in good faith which has not been independently 
verified and no warranty, express or implied, is made as to their accuracy,
completeness or correctness.  

This document is not an offer to sell or a solicitation to acquire or dispose
of an interest in financial instruments. 

If you have received this transmission in error, please telephone
+44 020 7676 8999 immediately so that we can arrange for its return.

*******************************************************************




-- 
Homepage: http://cgi.ethz.ch/~payerm/ GPG-Keys unter Privat/Kontakt