Serving static content
If you just want to serve simple static content without needing to have an entire web application, there are a couple of alternatives.
Using a servlet Context and DefaultHandler
There is an example of doing this in the jetty distribution in the $JETTY-HOME/contexts/javadoc.xml file. Here it is:
The Context is used to match urls of the form
/javadoc/*, and to set up the location of the static resources, which in this case is the directory
$JETTY-HOME/javadoc. The DefaultHandler serves the resources.
You would choose this method of serving static content if you want to be able to use Servlets and/or take advantage of the other features of the DefaultServlet.
Using a ContextHandler and a ResourceHandler
Alternatively, for a slightly more lightweight and simple solution you can use a ContextHandler and a ResourceHandler. Here is an example:
The ContextHandler is used to match urls of the form
/javadoc/*, and to set up the location of the static resources (again
$JETTY-HOME/javadoc). The ResourceHandler serves the resources.