title: Glassfish 3 - Loading images from a static server
body: <p>I'm trying to load images (and other static content) from a server outside of my web application which is deployed to <strong>Glassfish v3</strong>. I have the following configs in the <strong>web.xml</strong> but it does not work on Glassfish (but it works on Tomcat):</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;ExternalImagesServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.example.servlet.HttpProxyServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;RemoteURI&lt;/param-name&gt;
          &lt;param-value&gt;http://ip.of.second.server/website-files&lt;/param-value&gt;
      &lt;/init-param&gt;   
      &lt;init-param&gt;
          &lt;param-name&gt;AllowedContentTypes&lt;/param-name&gt;
          &lt;param-value&gt;image/gif,image/jpeg,image/png&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;ExternalImagesServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/images/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Where <strong>ip.of.second.server</strong> is an actual IP address of the server. I have the file called <strong>website-files.xml</strong> defined as follow:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context docBase="d:/internet/website/images" /&gt;
  </code></pre>
  
  <p>And website-files.xml is saved to <strong>glassfish\domains\domain1\config</strong> directory. But Glassfish does not pick up this config file.</p>
  
  <p>I have looked at Oracle Glassfish configuration doco but there's no mention on how you can reference images from a different server.</p>
  
  <p>Please help.</p>