closing ServletOutputStream
843841Jul 7 2006 — edited Jul 21 2006What is the best practice handling the ServletOutputStream after the response has been written and the stream is flushed with flush() and you are about to return from the doGet or service method of the Servlet?
Should we close the ServletOutputStream or not? Closing ought to assure that any future write to this stream will throw. But this does not imply that the container will close the HTTP connection to the browser or discard any other underlying IO streams. The behavior is container dependent but there should be some guidance.
In my view, after return from Servlet.doGet or equivalent the ServletOutputStream instance should be guaranteed not to be used again. Calling close() should have no effect. How is it in practice?
-Thomas