Created
October 8, 2014 08:03
-
-
Save xkr47/0e58f8e0ab5f9eb90e63 to your computer and use it in GitHub Desktop.
Disable persistent sessions in Tomcat embedded (which includes wicket sessions) (works at least with tomcat 7.0.54)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tomcat tomcat = new Tomcat() { | |
@Override | |
public Host getHost() { | |
if (host == null) { | |
host = new StandardHost() { | |
@Override | |
public void addChild(final Container child) { | |
if (child instanceof StandardContext) { | |
setupContextWithNonpersistentSessionManager(child); | |
} | |
super.addChild(child); | |
} | |
private void setupContextWithNonpersistentSessionManager(final Container child) { | |
StandardManager mgr = new StandardManager(); | |
mgr.setPathname(null); | |
child.setManager(mgr); | |
} | |
}; | |
host.setName(hostname); | |
getEngine().addChild(host); | |
} | |
return host; | |
} | |
}; | |
tomcat.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment