Version: 9.4.12.v20180830 |

jetty-web.xml
Previous | Chapter 32. Jetty XML Reference 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

## jetty-web.xml

`jetty-web.xml` is a Jetty configuration file that you can bundle with a specific web application. The format of `jetty-web.xml` is the same as jetty.xml – it is an XML mapping of the Jetty API.

This document offers an overview for using the `jetty-web.xml` configuration file. For a more in-depth look at the syntax, see Jetty XML Syntax.

### Root Element

`jetty-web.xml` applies on a per-webapp basis, and configures an instance of `org.eclipse.jetty.webapp.WebAppContext`.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

    <Configure class="org.eclipse.jetty.webapp.WebAppContext">
     ..
    </Configure>

> ### Caution

> Make sure you are applying the configuration to an instance of the proper class. `jetty-web.xml` configures an instance of `WebAppContext`; `jetty.xml` configures an instance of `Server`.

### Using jetty-web.xml

Place the `jetty-web.xml` into your web application’s `WEB-INF` folder. When Jetty deploys a web application, it looks for a file called `WEB-INF/jetty-web.xml` or `WEB-INF/web-jetty.xml` within the web application (or WAR) and applies the configuration found there. Be aware that `jetty-web.xml` is called after all other configuration has been applied to the web application.

> ### Important

> It is important to note that `jetty-web.xml` files utilize the webapp classpath, not the classpath of the server.

### jetty-web.xml Examples

The distribution contains an example of `jetty-web.xml` inside the WEB-INF folder of the `test` webapp WAR (`$JETTY_HOME/demo-base/webapps/test.war/WEB-INF/jetty-web.xml`).

### Additional `jetty-web.xml` Resources

- Jetty XML Syntax –in-depth reference for Jetty-specific configuration XML syntax.
- jetty.xml –configuration file for configuring the entire server

Previous | Top | Next
jetty.xml | Home | jetty-env.xml

See an error or something missing? Contribute to this documentation at Github!(Generated: 2018-08-30)