From cd6b59c61f1c9319fe09b0ab1b8b3e39f5a1df62 Mon Sep 17 00:00:00 2001 From: jcardus Date: Tue, 6 Jul 2021 18:29:36 +0100 Subject: use default session handler --- src/main/java/org/traccar/web/WebServer.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/traccar/web/WebServer.java b/src/main/java/org/traccar/web/WebServer.java index 354e12695..1f6af8b2d 100644 --- a/src/main/java/org/traccar/web/WebServer.java +++ b/src/main/java/org/traccar/web/WebServer.java @@ -26,11 +26,7 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.ErrorHandler; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.handler.gzip.GzipHandler; -import org.eclipse.jetty.server.session.DatabaseAdaptor; -import org.eclipse.jetty.server.session.DefaultSessionCache; -import org.eclipse.jetty.server.session.JDBCSessionDataStoreFactory; -import org.eclipse.jetty.server.session.SessionCache; -import org.eclipse.jetty.server.session.SessionHandler; +import org.eclipse.jetty.server.session.*; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; @@ -184,11 +180,10 @@ public class WebServer { databaseAdaptor.setDatasource(Context.getDataManager().getDataSource()); JDBCSessionDataStoreFactory jdbcSessionDataStoreFactory = new JDBCSessionDataStoreFactory(); jdbcSessionDataStoreFactory.setDatabaseAdaptor(databaseAdaptor); - SessionHandler sessionHandler = new SessionHandler(); + SessionHandler sessionHandler = servletHandler.getSessionHandler(); SessionCache sessionCache = new DefaultSessionCache(sessionHandler); sessionCache.setSessionDataStore(jdbcSessionDataStoreFactory.getSessionDataStore(sessionHandler)); sessionHandler.setSessionCache(sessionCache); - servletHandler.setSessionHandler(sessionHandler); } int sessionTimeout = config.getInteger(Keys.WEB_SESSION_TIMEOUT); -- cgit v1.2.3