title: Programmatically reading static resources from my java webapp
body: <p>I currently have a bunch of images in my .war file like this.</p>
  
  <pre><code>WAR-ROOT
    -WEB-INF
    -IMAGES
      -image1.jpg
      -image2.jpg
    -index.html
  </code></pre>
  
  <p>When I generate html via my servlets/jsp/etc I can simple link to </p>
  
  <p><a href="http://host/contextroot/IMAGES/image1.jpg" rel="noreferrer">http://host/contextroot/IMAGES/image1.jpg</a></p>
  
  <p>and</p>
  
  <p><a href="http://host/contextroot/IMAGES/image1.jpg" rel="noreferrer">http://host/contextroot/IMAGES/image1.jpg</a></p>
  
  <p>Not I am writing a servlet that needs to get a filesystem reference to these images (to render out a composite .pdf file in this case).  Does anybody have a suggestion for how to get a filesystem reference to files placed in the war similar to how this is?</p>
  
  <p>Is it perhaps a url I grab on servlet initialization?  I could obviously have a properties file that explicitly points to the installed directory but I would like to avoid additional configs.</p>