From f47349508d3a2dc2e78c30ebb42c24a65abcfa62 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 29 May 2015 23:03:53 +1200 Subject: Show live data on map --- src/org/traccar/http/AsyncServlet.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/http/AsyncServlet.java b/src/org/traccar/http/AsyncServlet.java index 2bc6ff7a1..4a83e09fd 100644 --- a/src/org/traccar/http/AsyncServlet.java +++ b/src/org/traccar/http/AsyncServlet.java @@ -35,6 +35,7 @@ import org.traccar.GlobalTimer; import org.traccar.database.DataCache; import org.traccar.helper.Log; import org.traccar.model.Position; +import org.traccar.model.User; public class AsyncServlet extends HttpServlet { @@ -182,16 +183,16 @@ public class AsyncServlet extends HttpServlet { context.setTimeout(ASYNC_TIMEOUT); HttpServletRequest req = (HttpServletRequest) context.getRequest(); - long userId = (Long) req.getSession().getAttribute(MainServlet.USER_KEY); + User user = (User) req.getSession().getAttribute(MainServlet.USER_KEY); synchronized (asyncSessions) { - if (!asyncSessions.containsKey(userId)) { - Collection devices = Context.getPermissionsManager().allowedDevices(userId); - asyncSessions.put(userId, new AsyncSession(userId, devices)); + if (!asyncSessions.containsKey(user.getId())) { + Collection devices = Context.getPermissionsManager().allowedDevices(user.getId()); + asyncSessions.put(user.getId(), new AsyncSession(user.getId(), devices)); } - asyncSessions.get(userId).request(context); + asyncSessions.get(user.getId()).request(context); } } -- cgit v1.2.3