title: Serving static content with grizzly's StaticHttpHandler from within a .jar
body: <p>I want Grizzly to serve static files from within a .jar, which contains a JAX-RS application, Grizzly and all other libs. I'm using <code>org.glassfish.grizzly.http.server.StaticHttpHandler</code> to serve the static files.</p>
  
  <pre><code>public class Main {
  
    // ...
  
    public static void main(String[] args) throws IOException, URISyntaxException {
      final HttpServer server = startServer();
      server.getServerConfiguration().addHttpHandler(
              new StaticHttpHandler(getTemplatePath()), "/static");
      System.in.read();
      server.stop();
    }
  
    private static String getTemplatePath() throws URISyntaxException {
      return Main.class.getClassLoader().getResource("templates/static").getPath();
    }
  }
  </code></pre>
  
  <p>But it works only, if I start the application with my IDE. If I pack a .jar and run it, the static files are not found.</p>
  
  <p>Is it possible to serve static files from within a .jar with grizzly's <code>StaticHttpHandler</code>? And how?</p>