Thanks Gang, Although, setting the buffer size didn't help in this case. After some more digging around I finally found that the problem was caused by a call to flushBuffer made by the jsp engine at the end of processing a page. By default, this call was passed by the wrapper object to the original response object, thus, causing the its commit field to be set to true. Overriding flushBuffer() to block calling the super made it possible for me to call setContentLength.
Dmitry At 07:42 PM 5/13/2002, Gang Zhang wrote: >One way to do it is to set a larger buffer for the servlet output streams. >Check something like "setBufferlength" function in servlet 2.3 api. > >Gang > >----- Original Message ----- >From: "Dmitry Beransky" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Monday, May 13, 2002 5:05 PM >Subject: filter is not setting Transfer-encoding: chunked > > > > Hi, > > > > I've run into a rather obscure, nonetheless important problem. I have a > > filter that wraps the response object into a custom wrapper class designed > > to collect JSP's output into a StringWriter. Once the call to the filter > > chain returns, I process (modify) the output collected in the StringWriter > > and return it to the client via a call to getWriter().write(...) on the > > original response object. The problem is that all of the responses > > generated in this fashion lack both Content-length and Transfer-encoding: > > chunked headers. Since the protocol used is most often HTTP/1.1 with > > keep-alive enabled, without either of these headers present a client > > doesn't know when to stop receiving data. This results in a progress bar > > lingering around the status field of the browser long after the page is > > rendered. > > > > I've tried setting the content-length header manually from the filter, but > > that doesn't work because even if I call setContentLength right after > > doFilter(), the response appears to be already committed and the call has > > no effect. I don't know what else I can try. Any ideas? > > > > Thanks > > Dmitry > > > > ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
