title: Simplest way to serve static data from outside the application server in a Java web application
body: <p>I have a Java web application running on Tomcat. I want to load static images that will be shown both on the Web UI and in PDF files generated by the application. Also new images will be added and saved by uploading via the Web UI.</p>
  <p>It's not a problem to do this by having the static data stored within the web container but storing and loading them from outside the web container is giving me headache.</p>
  <p>I'd prefer not to use a separate web server like Apache for serving the static data at this point. I also don't like the idea of storing the images in binary in a database.</p>
  <p>I've seen some suggestions like having the image directory being a symbolic link pointing to a directory outside the web container, but will this approach work both on Windows and *nix environments?</p>
  <p>Some suggest writing a filter or a servlet for handling the image serving but those suggestions have been very vague and high-level without pointers to more detailed information on how to accomplish this.</p>