I have a Struts2 Action that uses a StreamResult to stream a file. The file is a report that can be very large. I want to set a flag to restrict the user to one download at a time. In my Action, I can set the flag, but I do not have a place to unset it when the stream is finished.
Before Struts, I would set the flag, write to the Servlet’s OutputStream, and then unset the flag. But with Struts, the Action just sets the stream to a variable and then the Action is finished. Struts (as set up in struts.xml) then does the sending in a place outside of my control.
I think you should create an interceptor that wraps this download action, and it can lock/unlock access for the current user. See http://struts.apache.org/2.x/docs/interceptors.html for more information.