Hi I have a requirement to present the user with a list of files stored on the server, and then download the files selected to the user. If the user selects a single file - no problem. However if the user selects multiple files, then, unless anyone knows different, all the files have to be sent in the single input stream read by the stream result. Therefore I create a temporary file with File.createTempFile() and use the ZipOutputStream to zip the files and then return an input stream over the temp file. This works suprisingly well. However, the problem I've now got is, how to get rid of the temp files I am creating on the server?
file.deleteOnExit() is no use because the server VM will (in theory) never shutdown. Once the download is complete Struts automatically re-displays the original selection screen and provided the user uses the applicatoin supplied navigation to exit then I can delete the temp file, but if they simply close the browser or use the browser back button to navigate away I'm still left with the temp files sitting around. Creating the zipfile in memory is not an option as some of these can potentially be huge if the user goes mad and selects everything in sight. Is there someway of detecting/intercepting the fact that the Stream result has completed before Struts gets on with deciding what .jsp to display next so that I can safely clean up? Any other suggested approaches would be welome. Regards -- View this message in context: http://old.nabble.com/File-Download-with-multiple-files.-Design-question-tp30256036p30256036.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org