I have written a Servlet that is used to download some files from a server. The Servlet's logic determines which file is actually sent back, hence the reason the files are not linked to directly.
The Servlet basically reads the files and streams them as the response. In particular, it is using the Servlet's ServletOutputStream retrieved via response.getOutputStream(). My question is this: Should that OutputStream be closed? (I am flushing it.) Am I correct that a Servlet should not close that OutputStream, because that is the "responsibility" of the Servlet Container? And closing it can cause problems such as if a (Servlet) Filter needs to write to the stream?