title: Accessing both REST resources and static resources with Jersey
body: <p>I would like to use some static resources (images, js, css) from JSP pages served as Viewable</p>
  
  <p>I don't know how to use the WebPageContentRegex</p>
  
  <p>If I use servlet, I can execute resources but I can't access static files<br>
  If I use filter, I can access static files but I can't execute resources</p>
  
  <p>Could you please help me to access both?</p>
  
  <p>Here is my files:</p>
  
  <pre><code>webapp
    |____ resources
    |       |____ css
    |       |____ images
    |       |____ js
    |
    |____ WEB-INF
            |____ jsp
  </code></pre>
  
  <p>Here is my web.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns="http://java.sun.com/xml/ns/javaee" 
       xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
                           http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
  
  &lt;display-name&gt;test&lt;/display-name&gt;
  
  &lt;servlet&gt;
  &lt;servlet-name&gt;REST&lt;/servlet-name&gt;
  &lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;/servlet-class&gt;
  &lt;init-param&gt;
    &lt;param-name&gt;com.sun.jersey.config.property.packages&lt;/param-name&gt;
    &lt;param-value&gt;my packages&lt;/param-value&gt;
  &lt;/init-param&gt;
  &lt;init-param&gt;
    &lt;param-name&gt;com.sun.jersey.spi.container.ContainerRequestFilters&lt;/param-name&gt;
    &lt;param-value&gt;com.sun.jersey.api.container.filter.LoggingFilter&lt;/param-value&gt;
  &lt;/init-param&gt;
  &lt;init-param&gt;
    &lt;param-name&gt;com.sun.jersey.spi.container.ContainerResponseFilters&lt;/param-name&gt;
    &lt;param-value&gt;com.sun.jersey.api.container.filter.LoggingFilter&lt;/param-value&gt;
  &lt;/init-param&gt;
  &lt;init-param&gt;
    &lt;param-name&gt;com.sun.jersey.config.property.JSPTemplatesBasePath&lt;/param-name&gt;
    &lt;param-value&gt;/WEB-INF/jsp&lt;/param-value&gt;
  &lt;/init-param&gt;
  &lt;init-param&gt;
    &lt;param-name&gt;com.sun.jersey.config.property.WebPageContentRegex&lt;/param-name&gt;
    &lt;param-value&gt;(/resources/(css|images|js)/.*)|(/WEB-INF/jsp/.*\.jsp)&lt;/param-value&gt;
  &lt;/init-param&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;REST&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/resources/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;/webapp&gt;
  </code></pre>