I have developed a grails app which has user file uploads (docs, etc..), they are stored in the relative folder "web-app/upload".
My question is that I do not know what is the best way to perform automatically war deployments and keep this folder. Because when I redeploy in Tomcat the whole app folder is deleted and all the files are deleted.
Additionaly I need a generic configuration fron set an external location from this Files
Have you found a solution for that?
P.D.: If I use System.properties['base.dir'] the result is null, and if I use a ApplicationHolder.application.mainContext.getResource() it return a temp path. :(
I was able to solve partial as follow
I hope it can be useful to others
Regards, Yecid Pacífico
This code obtains the parent folder where the application is located:
I mean, if the web application were located in D:\somefolder\myWeb
path
would be D:\somefolder\myWeb\web-appparentStr
would be D:\somefolderSo you could save the files in D:\somefolder\files-outside-myWeb-context
Is it what you are looking for?
You should not be uploading files into your WAR structure. You should upload them to some external location.