Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable persistent sessions in Tomcat embedded (which includes wicket sessions) (works at least with tomcat 7.0.54)
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
You can’t perform that action at this time.