SECTION: 250-Configuration TITLE: 150xmljettyweb QUESTION: 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 webapplication.

The format of the jetty-web.xml file is the same as jetty.xml as described in the Jetty Tutorial, except that it is applied to a HttpContext instance rather than a HttpServer instance.

The following example jetty-web.xml file, sets an init parameter on the jsp servlet:


<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" "http://jetty.mortbay.org/configure_1_2.dtd">
<Configure class="org.mortbay.jetty.servlet.WebApplicationContext">
  <Call name="getServletHandler">
    <Call name="getServletHolder"><Arg>jsp</Arg>   
      <Call name="setInitParameter">
        <Arg>scratchdir</Arg>
	<Arg>/tmp/TestFAU</Arg>
      </Call>
    </Call>
  </Call>
</Configure>