aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-09-17 14:46:48 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-09-17 14:46:48 +1200
commitdc83dd3a3b99d79fa2df6f6f018891348b67c3ff (patch)
tree5563710ef06db80a2c9b2411f32a535941524241 /src
parentc0dee47e03f0c27bc700d3893f57447eccc2e53c (diff)
downloadtrackermap-server-dc83dd3a3b99d79fa2df6f6f018891348b67c3ff.tar.gz
trackermap-server-dc83dd3a3b99d79fa2df6f6f018891348b67c3ff.tar.bz2
trackermap-server-dc83dd3a3b99d79fa2df6f6f018891348b67c3ff.zip
Upgrade to Java 8
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/web/WebServer.java19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java
index 8887b6af3..4bb88578f 100644
--- a/src/org/traccar/web/WebServer.java
+++ b/src/org/traccar/web/WebServer.java
@@ -20,11 +20,9 @@ import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.proxy.AsyncProxyServlet;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.SessionManager;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.ResourceHandler;
-import org.eclipse.jetty.server.session.HashSessionManager;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
@@ -63,7 +61,7 @@ public class WebServer {
private final Config config;
private final DataSource dataSource;
private final HandlerList handlers = new HandlerList();
- private final SessionManager sessionManager;
+ private int sessionTimeout;
private void initServer() {
@@ -79,12 +77,7 @@ public class WebServer {
public WebServer(Config config, DataSource dataSource) {
this.config = config;
this.dataSource = dataSource;
-
- sessionManager = new HashSessionManager();
- int sessionTimeout = config.getInteger("web.sessionTimeout");
- if (sessionTimeout != 0) {
- sessionManager.setMaxInactiveInterval(sessionTimeout);
- }
+ sessionTimeout = config.getInteger("web.sessionTimeout");
initServer();
initApi();
@@ -158,7 +151,9 @@ public class WebServer {
WebAppContext app = new WebAppContext();
app.setContextPath("/");
- app.getSessionHandler().setSessionManager(sessionManager);
+ if (sessionTimeout > 0) {
+ app.getSessionHandler().setMaxInactiveInterval(sessionTimeout);
+ }
app.setWar(config.getString("web.application"));
handlers.addHandler(app);
}
@@ -166,7 +161,9 @@ public class WebServer {
private void initApi() {
ServletContextHandler servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
servletHandler.setContextPath("/api");
- servletHandler.getSessionHandler().setSessionManager(sessionManager);
+ if (sessionTimeout > 0) {
+ servletHandler.getSessionHandler().setMaxInactiveInterval(sessionTimeout);
+ }
servletHandler.addServlet(new ServletHolder(new AsyncSocketServlet()), "/socket");