diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-10-18 14:32:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-18 14:32:51 -0700 |
commit | 0d5dd20257ab5a4c77ff628b67e6d54931d8ae16 (patch) | |
tree | 9c5be8d286ef0f2244329d60385e9e8f1fef6fbd /src/main/java/org/traccar/api/AsyncSocketServlet.java | |
parent | a9f5599a1ae18279339a7ff17058d40b9ed4fab4 (diff) | |
parent | 3ad889413e4b13d2dd6a2aa6454964dd9427fb28 (diff) | |
download | trackermap-server-0d5dd20257ab5a4c77ff628b67e6d54931d8ae16.tar.gz trackermap-server-0d5dd20257ab5a4c77ff628b67e6d54931d8ae16.tar.bz2 trackermap-server-0d5dd20257ab5a4c77ff628b67e6d54931d8ae16.zip |
Merge pull request #4584 from kamaci/master
Anonymous types are replaced with lambda
Diffstat (limited to 'src/main/java/org/traccar/api/AsyncSocketServlet.java')
-rw-r--r-- | src/main/java/org/traccar/api/AsyncSocketServlet.java | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/main/java/org/traccar/api/AsyncSocketServlet.java b/src/main/java/org/traccar/api/AsyncSocketServlet.java index 9318b6fc6..51fbfb478 100644 --- a/src/main/java/org/traccar/api/AsyncSocketServlet.java +++ b/src/main/java/org/traccar/api/AsyncSocketServlet.java @@ -15,9 +15,6 @@ */ package org.traccar.api; -import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest; -import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse; -import org.eclipse.jetty.websocket.servlet.WebSocketCreator; import org.eclipse.jetty.websocket.servlet.WebSocketServlet; import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory; import org.traccar.Context; @@ -30,15 +27,12 @@ public class AsyncSocketServlet extends WebSocketServlet { @Override public void configure(WebSocketServletFactory factory) { factory.getPolicy().setIdleTimeout(Context.getConfig().getLong("web.timeout", ASYNC_TIMEOUT)); - factory.setCreator(new WebSocketCreator() { - @Override - public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) { - if (req.getSession() != null) { - long userId = (Long) req.getSession().getAttribute(SessionResource.USER_ID_KEY); - return new AsyncSocket(userId); - } else { - return null; - } + factory.setCreator((req, resp) -> { + if (req.getSession() != null) { + long userId = (Long) req.getSession().getAttribute(SessionResource.USER_ID_KEY); + return new AsyncSocket(userId); + } else { + return null; } }); } |