I have an action in struts 2
where it opens an FileInputStream
, reads an image and shows it in a jsp.
The question is that when struts is finished with getting the image, will it automatically take care of the FileInputStream
and close()
it or the stream is left open
?
Struts2 will take care of closing the input stream once it has done the work for you.
Here is the link to the source code and you can very well see that it has been taken care to close the stream.
Struts2 StreamResult Source Code
Here is the code snippet from the same:
finally {
if (inputStream != null) inputStream.close();
if (oOutput != null) oOutput.close();
}
Hope will give you clear idea how things are going underway.