You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/05/08 23:04:16 UTC

DO NOT REPLY [Bug 8918] New: - Wrong ContentType set.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8918>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

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

Wrong ContentType set.

           Summary: Wrong ContentType set.
           Product: Tomcat 4
           Version: 4.0.3 Final
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Connector:Webapp
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: mackenzie@berbee.com


I have Apache 1.24 
and Tomcat4.0.3 
configured on a Sun sparc solaris 8 machine.
JVM is Sun's j2se from Sun.
Version=
mackenzie@toma logs$ /usr/j2se/bin/java -fullversion
java full version "1.4.0-b92"
mackenzie@toma logs$

mod_webapp was compiled from cvs checkout on May 7
mod_webapp.c version 
@version $Id: mod_webapp.c,v 1.33 2002/05/03 13:30:25 pier Exp $


Using either mod_webapp(or mod_jk) when Tomcat issues an error page the 
ContentType is returned to the browser as "Content-Type: text/plain" which is 
fine if you use IE ;-)

I tested this with a simple servlet which just does this in the doGet()
res.sendError( HttpServletResponse.SC_BAD_REQUEST, "Test Content Type Error 
Message" );

Via the built in HTTP connector all is fine. However, via apache and webapp, 
ContentType is incorrect and is set to "text/plain".

If I specifically set ContentType as well in my test servlet
res.setContentType("text/html");

then it works in all test scenarios.

According to javadoc for public void sendError(int sc, java.lang.String msg) 
'The server defaults to creating the response to look like an HTML-formatted 
server error page containing the specified message, setting the content type 
to "text/html", leaving cookies and other headers unmodified.'

Hope this helps.

Cheers Mark

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>