On Wed, Nov 24, 2010 at 10:23 PM, Caldarale, Charles R <chuck.caldar...@unisys.com> wrote: > From: declan harrison [mailto:harrison.dec...@gmail.com] >> Subject: Re: Tomcat 6.0.24 - Should send body As Chunked Response but >> sometimes sends it back Un-Chunked > >> > Do you have any part of the response stored as an >> > instance field in your servlet? > >> Yes I have a reference to the HttpServletResponse, >> response.getOutputStream(), which I close when Im done. > > Fatal error - don't ever do that. Multiple threads running through your > servlet will walk over each other. It's fine to have local variables > pointing to objects related to a request or response, but having instance or > static variables do so is guaranteed to cause problems. Remember that each > servlet (or filter) is instantiated *once* for the lifetime of the webapp, > not once per request. > > - Chuck Hi Chuck
Sorry for my misleading statement I meant I have local variable that reference the response output stream. I dont have a servlet attribute that holds a reference to the response stream > > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY > MATERIAL and is thus for use only by the intended recipient. If you received > this in error, please contact the sender and delete the e-mail and its > attachments from all computers. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org