Friday, September 24, 2010

Disabling JSESSIONID in Jetty context XML

The following snippet shows how to deploy a web application/.war via a Jetty context XML file with JSESSIONID disabled.

<Configure id="cs" class="org.mortbay.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
  <Set name="war">/foo/bar/myapp.war</Set>
  <!-- Turn off JSESSIONID -->
  <Get id="sh" name="sessionHandler"/>
  <Ref id="sh">
      <Get name="sessionManager">
          <Set name="sessionURL">none</Set>

To be clear: you'd save this as foo.xml and place it in $JETTY_HOME/contexts and your app would be deployed.

If you want JSESSIONID disabled when working with the maven-jetty-plugin or when embedding Jetty, check out Alex's post on removing JSESSIONID.

No comments:

Post a Comment