In my web based application (Tomcat7 / JDK 7 - JSP 3.0), I built a translator to take csv files, clean them up, and save the file off. A second part then parses the file for certain information and creates a second file (so it can be loaded into another system for verification). This happens every day. These files are being written to ${ECLIPSE_HOME} (because I'm running this in Eclipse).
What I want to do is have a folder created in the application's root directory {i.e, [app-root]/toBeDLd} specifically for saving the generated files into and downloading them, have my front end JSP be able to read and display the files (like a list of downloadable files, you click the link it downloads in your web browser) and at a specific time, delete all the files in that directory. I don't need to keep them, or have a backup of them.
From what I have read, Sending OutputStream to browser and let browser save it would be a decent starting point, but I have also read some other comments on SO that it is a violation of servlet spec to save files inside of the web app directory. I'm not sure if that is due to it being the root of the webapp or not though. Ideally I would like to keep this completely contained within the web application.
Is this possible? Is this the best way to do this?