Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Configuring an override web.xml file 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:

Code Block
xml
xml

<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:

Code Block
java
java

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");

Configuring an override web.xml file for the jetty maven plugin

<project>
Use the <overrideWebXml> element as follows:

Code Block
xml
xml

<project>
  ...

...


  <plugins>
    ...

...


      <plugin>
        <groupId>org.mortbay.jetty</groupId>

...


        <artifactId>maven-jetty-plugin</artifactId>

...


        <configuration>
          ...
          <overrideWebXml>src/main/resources/override-web.xml</overrideWebXml>

...


          ...

...


        </configuration>

...


      </plugin>

...


    ...

...


    </plugins>

...


 </project>

There is more information on configuring the jetty maven plugin here.

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 from 1 day to full product delivery