aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/http/AsyncServlet.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-29 23:03:53 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-29 23:03:53 +1200
commitf47349508d3a2dc2e78c30ebb42c24a65abcfa62 (patch)
tree3b676b2d31790553b879bf876b1eac9149d25342 /src/org/traccar/http/AsyncServlet.java
parent2f3c714d6abcdb62983abe48404afa24a672231b (diff)
downloadtrackermap-server-f47349508d3a2dc2e78c30ebb42c24a65abcfa62.tar.gz
trackermap-server-f47349508d3a2dc2e78c30ebb42c24a65abcfa62.tar.bz2
trackermap-server-f47349508d3a2dc2e78c30ebb42c24a65abcfa62.zip
Show live data on map
Diffstat (limited to 'src/org/traccar/http/AsyncServlet.java')
-rw-r--r--src/org/traccar/http/AsyncServlet.java11
1 files changed, 6 insertions, 5 deletions
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<Long> devices = Context.getPermissionsManager().allowedDevices(userId);
- asyncSessions.put(userId, new AsyncSession(userId, devices));
+ if (!asyncSessions.containsKey(user.getId())) {
+ Collection<Long> 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);
}
}