May 14, 2013 4 Comments
Just add a Jetty9-RunConfig in IDEA (or Eclipse, if you have to) and create static.xml with the following content in $JETTY_HOME/webapps.
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.eclipse.org/configure.dtd"> <Configure class="org.eclipse.jetty.server.handler.ContextHandler"> <Set name="contextPath">/static</Set> <Set name="resourceBase">/path/to/your/document/root/</Set> <Set name="handler"> <New class="org.eclipse.jetty.server.handler.ResourceHandler"> <Set name="cacheControl">no-cache</Set> </New> </Set> </Configure>
Don’t forget to adjust resourceBase to your liking.
Note: I also disabled caching in this example.