I have a spring boot application that uses spring-web and embedded tomcat.
The app has a REST URI where a tar file will be posted to. The tar file will have a number of .csv files. The tar will be kept in a persistent data store for later retrieval.
When a user requests (using another REST API) to view the content of the tar, the application will
- fetch the relevant tar file from the database
- untar the relevant tar file into a randomly generated new directory inside system /tmp dir
- generate HTML pages (one for each csv) which has some bootstrap and other css involved for better UI look of the CSV data in tabular form
- and should be able to serve those pages.
- when the user logs off or after a certain time period of inactivity the randomly generated
/tmp
dir should be removed
Note that the additional requirement multiple users can access this server and upload/view different tar files at the same time and hence the need for creating a new temporary directory.
Questions:
- How to achieve the ability to serve dynamically generated HTML pages inside a random temp directory that is outside the scope of server's web-inf?
- Is it possible to achieve the same if I create temp directories inside the context path?
- How to achieve this for concurrent users trying to access different directories respectively?
- Are there any suggestions on a better way to design what I intend to do with the application here?