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 2003/05/07 12:42:28 UTC

DO NOT REPLY [Bug 19721] New: - DefaultServlet sets ContentType after opening stream

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=19721>.
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=19721

DefaultServlet sets ContentType after opening stream

           Summary: DefaultServlet sets ContentType after opening stream
           Product: Tomcat 4
           Version: 4.1.24
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: ronald@echteman.nl


The method DefaultServlet.serveResource(...) first gets the outputStream and
than sets the contentType.
Filters (like compressionFilter from the examples) often check the contentType
in getOutputStream() to check if they have to wrap the outputstream, but the
contentType gets set after getOutputStream is called, so the filter get 'null'
as contentType.
The filters can be made more complex by waiting for the first byte to get
written and then ask for the ContentType, but maybe it's easier to let
DefaultServlet first set the contentType and than get the outputstream.
Any thoughts on this?

Because of this bug, the compressionFilter only filters custom servlets/jsp and
not static content.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org