I successfully embedded Jetty on a test application. It can serve files without issues. Now I want to know if it's possible for Jetty to serve files that are inside its own Jar file.
Does anyone know if that's possible?
An example is listed on the Jetty embedding page at http://docs.codehaus.org/display/JETTY/Embedding+Jetty
The trick is to create a File URL to your classpath location.
String webDir = this.class.getClassLoader().getResource("com/company/project/mywebdir").toExternalForm(); ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/"); context.setResourceBase(webDir);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With