aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/PositionServlet.java
diff options
context:
space:
mode:
authorRafael Guterres <guterresrafael@gmail.com>2015-11-27 03:32:59 -0200
committerRafael Guterres <guterresrafael@gmail.com>2015-11-27 03:32:59 -0200
commitc57bd2d472467b1b3a45aee1b97c9a0aeef5958a (patch)
tree26fae20adf1970b5834f06393a3c703c972f39b1 /src/org/traccar/web/PositionServlet.java
parent77cd23da84ebebcf99a97a8aef88aa9a4884ca40 (diff)
downloadtraccar-server-c57bd2d472467b1b3a45aee1b97c9a0aeef5958a.tar.gz
traccar-server-c57bd2d472467b1b3a45aee1b97c9a0aeef5958a.tar.bz2
traccar-server-c57bd2d472467b1b3a45aee1b97c9a0aeef5958a.zip
Initial implementation of new api with jax-rs.
Revert servlets to old api and remove plurals. Fix findbugs for header origin.
Diffstat (limited to 'src/org/traccar/web/PositionServlet.java')
-rw-r--r--src/org/traccar/web/PositionServlet.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/org/traccar/web/PositionServlet.java b/src/org/traccar/web/PositionServlet.java
index c63968251..796d6a81f 100644
--- a/src/org/traccar/web/PositionServlet.java
+++ b/src/org/traccar/web/PositionServlet.java
@@ -23,9 +23,8 @@ import org.traccar.model.Position;
import java.util.HashMap;
import java.util.Map;
-import org.traccar.model.Device;
-public class PositionServlet extends BaseServletResource<Position> {
+public class PositionServlet extends BaseServlet {
@Override
protected boolean handle(String command, HttpServletRequest req, HttpServletResponse resp) throws Exception {
@@ -43,10 +42,9 @@ public class PositionServlet extends BaseServletResource<Position> {
return true;
}
- @Override
- protected void get(HttpServletRequest req, HttpServletResponse resp) throws Exception {
+ private void get(HttpServletRequest req, HttpServletResponse resp) throws Exception {
long deviceId = Long.parseLong(req.getParameter("deviceId"));
- Context.getPermissionsManager().check(Device.class, getUserId(req), deviceId);
+ Context.getPermissionsManager().checkDevice(getUserId(req), deviceId);
sendResponse(resp.getWriter(), JsonConverter.arrayToJson(
Context.getDataManager().getPositions(
getUserId(req), deviceId,
@@ -61,7 +59,7 @@ public class PositionServlet extends BaseServletResource<Position> {
for (String deviceIdString : req.getParameterValues("devicesId")) {
Long deviceId = Long.parseLong(deviceIdString);
- Context.getPermissionsManager().check(Device.class, userId, deviceId);
+ Context.getPermissionsManager().checkDevice(userId, deviceId);
Position position = Context.getConnectionManager().getLastPosition(deviceId);
positions.put(deviceId.toString(), position);