Your solution of storing your files outside of your deployed web application is the correct one.
If you store them within the web app directory, it gets deleted on redploy (as you have noted)
That then raises the question - well how do you access them again?
And the answer to that is: with another
servlet.
One that would do the opposite of the one you have written here - read the file from disk, and stream it out on the Servlet response output stream
Like this for example
cheers,
Stefan