title: Serving static files with Jersey 2
body: <p>I'm new to Jersey and servlets in general so hopefully I'm just missing something simple...</p>
  
  <p>I've got a Jersey app (v2.13) up and running using Guice (3.0) for dependency injection along with some static files in src/main/webapp. If I map my Jersey servlet to anything other than /* and make a request for a static file in the webapp folder, it gets served up no problem. If I map my Jersey servlet to the root, any request for a static file is met with a 404.</p>
  
  <p>I'd really prefer to have the Jersey servlet mapped to the root but I also need to be able to serve static content. Is there any way to accomplish this? Perhaps to map the Jersey servlet to the root but ignore requests for /assets/* or something similar?</p>
  
  <p>Here is my web.xml:</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;guice-filter&lt;/filter-name&gt;
      &lt;filter-class&gt;com.google.inject.servlet.GuiceFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;guice-filter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;com.example.MyGuiceServletContextListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;Jersey Web Application&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt;
          &lt;param-value&gt;com.example.MyResourceConfig&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Jersey Web Application&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>