Community
Participate
Working Groups
The DefaultServlet and the error page code (which I haven't located) both set the content length unconditionally to the length of the static content unless the request is marked as an include. If there is a filter that writes content before (or, presumably after) the default content the content length is wrong and the client only gets part of the response. For the default servlet case, commenting out line 942 // r.setLongContentLength(count); and around 951 // if (count != -1) // { // if (count<Integer.MAX_VALUE) // response.setContentLength((int)count); // else // response.setHeader(HttpHeaders.CONTENT_LENGTH,Long.toString(count)); // } fixes the problem but this is surely not a desirable solution.
this is a dangerous kind of filter to support. Filters that change the content length really should wrap the response and control the content length header. But I have added HttpOutput.isWritten() and the default servlet now checks to see if the response has been written before attempting to set the content length.
The fix in trunk in rev 2265 works for response.getOuputStream() but not response.getWriter()
r2268 added fix to jetty-7 to handle writers. will merge to 8 soon.