Enables the use of session management in Jetty.

This feature available is needed not by Gerrit itself
(as GerritAccount cookie is used) but more for other
plug-ins running inside the same Servlet Container.

E.g. GitBlit requires the use of Servlet sessions
(JSESSIONID) and this feature allows to avoid having
multiple JVMs and running the plug-in in the same
container as Gerrit.

Change-Id: I4d0af696a69eb9228c6b2e3eb81affb5ee80e05d
This commit is contained in:
Luca Milanesio
2012-09-01 02:44:49 +01:00
parent 57973eb9aa
commit 7752a9cf2a

View File

@@ -38,6 +38,7 @@ import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.FilterHolder;
@@ -315,6 +316,11 @@ public class JettyServer {
final JettyEnv env) throws MalformedURLException, IOException {
final ServletContextHandler app = new ServletContextHandler();
// This enables the use of sessions in Jetty, feature available
// for Gerrit plug-ins to enable user-level sessions.
//
app.setSessionHandler(new SessionHandler());
// This is the path we are accessed by clients within our domain.
//
app.setContextPath(contextPath);