Hi! Regarding the issue we discussed recently about issue 50748, Content-Length header and DefaultServlet.
Usually DefaultServlet serves the content using an OutputStream, but if getWriter() was already called, the stream will not be available and ISE will be thrown. There is a workaround implemented for that: In DefaultServlet#serveResource(..): try { ostream = response.getOutputStream(); } catch (IllegalStateException e) { // If it fails, we try to get a Writer instead if we're // trying to serve a text file if ( (contentType == null) || (contentType.startsWith("text")) || (contentType.endsWith("xml")) ) { writer = response.getWriter(); } else { throw e; } } I think that if we fall back to using a Writer, the content-length header must not be set by the DefaultServlet in the lines that follow the above block of code. That said, I am not sure why anybody should rely on DefaultServlet being able to serve the resource in this case at all. It is a nice feature, though. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org