Appendix A.3.5.2 Jetty Standalone
You can modify any of the settings inside the version of webdefault.xml shipped in the Jetty distribution and apply it to an individual web application by using:
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
...
<Setname="defaultsDescriptor">/my/path/to/webdefault.xml</Set>
...
</Configure>
Which equivalently in code is:
import org.mortbay.jetty.webapp.WebAppContext;
...
WebAppContext wac = new WebAppContext();
...
//Set up the absolute path to the custom webdefault.xml.
//Alternatively, you can use a classloader to find the
//resource representing your custom webdefault.xml
wac.setDefaultsDescriptor("/my/path/to/webdefault.xml");
...
If you want to apply the same custom webdefault.xml to a number of webapps, then supply the path to the file to the hot deployer or the static deployer:
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
...
<Set name="defaultsDescriptor">/my/path/to/webdefault.xml</Set>
</New>
- Jetty Maven Plugin
Similarly, for the Maven Jetty plugin, you provide a customized webdefault.xml file for your webapp by:
<project>
...
<plugins>
...
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
...
<webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
...
</configuration>
</plugin>
</plugins>
</project>


