I want to be able to write to an OutputStream of a HttpServletResponse even after the request thread exits (i.e. from a different thread).
Problem is, the output stream gets automatically closed when the request thread exits.
I was wondering if there is any way to configure the the response (or possibly the web container, Tomcat in my case) so that its output stream won’t get closed unless I order so explicitly?
Thank you.
no, there is no such thing. Once the servlet has finished running, the response is sent back to the client and you can no more write on the response.
Make sure you do the processing of the response when you are in the servlet.