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 (cont)

Hi,

   I continue here the thread I started before since I lost the thread :). In the bottom you will see the original post. So, I ran server dump both for a case where I don't do anything in the context listener (sessionHander.stop() and then start), and for the case where I do stop and start the session handler and both look exactly the same. More over, I wrote a simple context listener that simply does stop and then start on the session handler, and the problem exists (the sessionManger in the Request can't be found).

   I think I tracked down the problem to the fact that after stopping and then starting the session handler, the ServletHandler looses its _outerScope, causing it not the call back to the handle on the SessionHandler when its scope is being processed. I saw that the outer scope is set using thread local, maybe that can be the problem?

Cheers,
Shay


=== Original Post ====

 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