Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Replacing the SessionMananger in a ServletContextListener, worked in 6, fails in 7

Hi,

   I use a ServletContextListener to replace the SessionManager Jetty uses (I need this since the knowledge of which session manager to use exists within the web app). The following code worked in version 6, but in 7, it seems like the code causes the SessionHandler to be removed from the chain:

ServletContextHandler jettyContext = (ServletContextHandler) ((ContextHandler.Context) servletContext).getContextHandler();
SessionHandler sessionHandler = jettyContext.getSessionHandler();
try {
    sessionHandler.stop();
} catch (Exception e) {
    throw new RuntimeException("Failed to stop session handler to inject our own session manager", e);
}

// ....

sessionHandler.setSessionManager(mySessionManager);

try {
    sessionHandler.start();
} catch (Exception e) {
    throw new RuntimeException("Failed to start session handler to inject our own session manager", e);
}

Back to the top