aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-24 10:45:26 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-24 10:45:26 -0800
commit98993ee219b6c0cb31f2f3b1608d378b2e028535 (patch)
tree77a6e8366c27b8b3851e52b6ab81ff62920b970c /src/org/traccar/api
parenta129cfd3159c02b4f3996dbdfb5299ac95a6720c (diff)
downloadtrackermap-server-98993ee219b6c0cb31f2f3b1608d378b2e028535.tar.gz
trackermap-server-98993ee219b6c0cb31f2f3b1608d378b2e028535.tar.bz2
trackermap-server-98993ee219b6c0cb31f2f3b1608d378b2e028535.zip
Refactor geolocation
Diffstat (limited to 'src/org/traccar/api')
-rw-r--r--src/org/traccar/api/MediaFilter.java4
-rw-r--r--src/org/traccar/api/SecurityRequestFilter.java6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/api/MediaFilter.java b/src/org/traccar/api/MediaFilter.java
index 25e242b01..53539770f 100644
--- a/src/org/traccar/api/MediaFilter.java
+++ b/src/org/traccar/api/MediaFilter.java
@@ -30,7 +30,9 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.traccar.Context;
+import org.traccar.Main;
import org.traccar.api.resource.SessionResource;
+import org.traccar.database.StatisticsManager;
import org.traccar.helper.Log;
import org.traccar.model.Device;
@@ -51,7 +53,7 @@ public class MediaFilter implements Filter {
userId = (Long) session.getAttribute(SessionResource.USER_ID_KEY);
if (userId != null) {
Context.getPermissionsManager().checkUserEnabled(userId);
- Context.getStatisticsManager().registerRequest(userId);
+ Main.getInjector().getInstance(StatisticsManager.class).registerRequest(userId);
}
}
if (userId == null) {
diff --git a/src/org/traccar/api/SecurityRequestFilter.java b/src/org/traccar/api/SecurityRequestFilter.java
index 195c1f72f..33b6b37df 100644
--- a/src/org/traccar/api/SecurityRequestFilter.java
+++ b/src/org/traccar/api/SecurityRequestFilter.java
@@ -18,7 +18,9 @@ package org.traccar.api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.Context;
+import org.traccar.Main;
import org.traccar.api.resource.SessionResource;
+import org.traccar.database.StatisticsManager;
import org.traccar.helper.DataConverter;
import org.traccar.model.User;
@@ -77,7 +79,7 @@ public class SecurityRequestFilter implements ContainerRequestFilter {
String[] auth = decodeBasicAuth(authHeader);
User user = Context.getPermissionsManager().login(auth[0], auth[1]);
if (user != null) {
- Context.getStatisticsManager().registerRequest(user.getId());
+ Main.getInjector().getInstance(StatisticsManager.class).registerRequest(user.getId());
securityContext = new UserSecurityContext(new UserPrincipal(user.getId()));
}
} catch (SQLException e) {
@@ -89,7 +91,7 @@ public class SecurityRequestFilter implements ContainerRequestFilter {
Long userId = (Long) request.getSession().getAttribute(SessionResource.USER_ID_KEY);
if (userId != null) {
Context.getPermissionsManager().checkUserEnabled(userId);
- Context.getStatisticsManager().registerRequest(userId);
+ Main.getInjector().getInstance(StatisticsManager.class).registerRequest(userId);
securityContext = new UserSecurityContext(new UserPrincipal(userId));
}