tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergei Ostavnenko" <>
Subject RE: Different Content Type returned by Tomcat 4.1 and Tomcat 4.0. Please Help!
Date Wed, 09 Apr 2003 19:54:36 GMT
I actually agree with the statement that the content type should not be 
modified by default.
But the problem is that the new version of Tomcat (v4.1.18 or v4.1.24) does 
assign "text/plain" content type to the response that is coming from a 
servlet unless it was explicitly assigned within the servlet.

I think the change happened when Tomcat switched from HTTP/1.1 connector to 
Coyote.  As I said before, Tomcat 4.0.2 (and prior) doesn't supply any 
content type if none was explicitly specified, and Tomcat 4.1.18 (and later, 
I didn't test versions in between) sets it to "text/plain".

Is it a bug?

>From: "Shapira, Yoav" <>
>Reply-To: "Tomcat Users List" <>
>To: "Tomcat Users List" <>,   
>Subject: RE: Different Content Type returned by Tomcat 4.1 and Tomcat 4.0. 
>Please Help!
>Date: Wed, 9 Apr 2003 08:58:04 -0400
> >Although, I still have a feeling that certain Tomcat configuration
> >should be available in order to make it handle the Content Type in the
> >way as Tomcat 4.0 does.  Any ideas on that?
>I wouldn't like it, and here's why:
>1. Tomcat is a servlet/JSP container.  For servlets/JSP, the author is
>explicitly responsible for specifying the content type of the response.
>2. Technicalities: setContentType() must be called before getWriter() or
>getOutputStream().  The servlets/JSPs always get a writer or output
>stream if they do anything meaningful.  So the container would have to
>set the "default" content-type before getWriter() or getOutputStream()
>is called, and before the servlet/JSP has had a chance to set it.  The
>container would set it, and then the servlet/JSP would have to set it
>again.  This could get confusing and is not natural anyways: the
>processing pipeline is cleaner with only one setContentType call per
>response instance.
>That said, I'm not overwhelmingly against it.  If the setting of a
>default content type by the container was a popular request, and
>implemented as a configurable thing with the default off to stay
>consistent with the spec, it wouldn't be terrible.
>I'm interested in where the different behavior comes from between 4.0.x
>and 4.1.x.  You're using the same connector?
>Yoav Shapira
>Millennium ChemInformatics
>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:
>For additional commands, e-mail:

Add photos to your e-mail with MSN 8. Get 2 months FREE*.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message