Jetty Logo
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery

Configuring Static Content Deployment

Should you want to serve purely static content, you can use the Jetty Deployment Descriptor XML concepts and the internal ResourceHandler to setup simple serving of static content.

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "">

<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
  <Set name="contextPath">/ratlines/apidoc</Set>
  <Set name="resourceBase">/home/admiral/projects/ratlines/apidoc/</Set>
  <Set name="handler">
    <New class="org.eclipse.jetty.server.handler.ResourceHandler">
      <Set name="welcomeFiles">
        <Array type="String">
      <Set name="cacheControl">max-age=3600,public</Set>

This is a very basic setup for serving static files, if you want advanced static file serving, use the DefaultServlet.

See an error or something missing? Contribute to this documentation at Github!