Version: 9.3.16.v20170120 |

Configuring Static Content Deployment
Previous | Chapter 4. Deploying to Jetty Home | Next

##### Contact the core Jetty developers at www.webtide.com

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 for sponsored feature development

## Configuring Static Content Deployment

To serve purely static content, the Jetty Deployment Descriptor XML concepts and the internal `ResourceHandler` can be used. Create a file called `scratch.xml` in the `${jetty.base}/webapps` directory and paste the following file contents in it.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
    <Configure class="org.eclipse.jetty.server.handler.ContextHandler">
      <Set name="contextPath">/scratch</Set>
      <Set name="handler">
        <New class="org.eclipse.jetty.server.handler.ResourceHandler">
          <Set name="resourceBase">/home/jesse/scratch</Set>
          <Set name="directoriesListed">true</Set>
        </New>
      </Set>
    </Configure>

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

Previous | Top | Next
Deployment Processing of WebAppContexts | Home | Hot Deployment

See an error or something missing? Contribute to this documentation at Github!(Generated: 2017-01-20)