I'm developing a java/spring-mvc web app that using a scheduling system generate csv files to send via e mail.
My first idea was to generate these files locally in server and then send them to recipients, but now I have a doubt. Where to store temp files?
I will deploy my application as a war, so I know there could be problems.
Is it a bad idea to create a temporary directory in my WEB-INF directory? An alternative could be to serialize these files and store them in a database table.
What's your suggestion? any best practice?
I would left it on jvm, i.e. use java.io.tmpdir
system property. Create a directory in tmp dir (new File(system.getProperty("java.io.tmpdir")).mkdir()
) or just a file in the tmp directory (File.createTempFile("name", ".csv")
).
For application running on Tomcat, the tmp dir is <catalina_home_directory>/temp
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With