Appendix A 3.6.1 Configuring an Override web.xml for Jetty Standalone

There is an example of applying an override web.xml file in $jetty.home/contexts/test.xml. To apply an override to a single webapp:

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
  ...
  <Set name="overrideDescriptor"><SystemProperty name="jetty.home" 
default="."/>/my/path/to/override-web.xml</Set>
  ...
</Configure>

In code, this is:

import org.mortbay.jetty.webapp.WebAppContext;

...

WebAppContext wac = new WebAppContext();

...

//Set the absolute path to the override descriptor.

//Alternatively, use the classloader to get the path to the

//override descriptor as a resource.

wac.setOverrideDescriptor(System.getProperty("jetty.home")
+"/my/path/to/override-web.xml"); 

  • Currently 2.95/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
  Flag Inappropriate Content 0 comments