What is jetty-web.xml?

The jetty-web.xml file is a jetty configuration file that can be bundled with a specific web application. When jetty deploys a webapplication, 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 after all other configuration has been applied to the web application.

The format of the jetty-web.xml file is the same as jetty.xml. That is, it is an xml mapping of the jetty API. Note that the object to which it is applied is an org.mortbay.jetty.webapp.WebAppContext instance rather than an org.mortbay.jetty.Server instance:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
  ...
</Configure>


There is an example of this file in the distribution at $JETTY_HOME/webapps/test/WEB-INF/jetty-web.xml.