6/14/2016

Use Jetty to serve static content

ResourceHandler resourceHandler2 = new ResourceHandler();
resourceHandler2.setDirectoriesListed(true);
resourceHandler2.setResourceBase("/path/to/static_files");
ContextHandler staticContextHandler2 = new ContextHandler("/html");
staticContextHandler2.setHandler(resourceHandler2);

...

handlerList handlers = new HandlerList();
handlers.addHandler(servletContextHandler);
handlers.addHandler(staticContextHandler2);

httpServer.setHandler(handlers);

No comments: