aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/api/SecurityRequestFilter.java6
-rw-r--r--src/org/traccar/api/resource/ServerResource.java5
-rw-r--r--src/org/traccar/api/resource/SessionResource.java9
3 files changed, 7 insertions, 13 deletions
diff --git a/src/org/traccar/api/SecurityRequestFilter.java b/src/org/traccar/api/SecurityRequestFilter.java
index 782ca7de5..f207b6bff 100644
--- a/src/org/traccar/api/SecurityRequestFilter.java
+++ b/src/org/traccar/api/SecurityRequestFilter.java
@@ -48,7 +48,7 @@ public class SecurityRequestFilter implements ContainerRequestFilter {
}
@javax.ws.rs.core.Context
- private HttpServletRequest req;
+ private HttpServletRequest request;
@javax.ws.rs.core.Context
private ResourceInfo resourceInfo;
@@ -75,9 +75,9 @@ public class SecurityRequestFilter implements ContainerRequestFilter {
throw new WebApplicationException(e);
}
- } else if (req.getSession() != null) {
+ } else if (request.getSession() != null) {
- Long userId = (Long) req.getSession().getAttribute(SessionResource.USER_ID_KEY);
+ Long userId = (Long) request.getSession().getAttribute(SessionResource.USER_ID_KEY);
if (userId != null) {
securityContext = new UserSecurityContext(new UserPrincipal(userId));
}
diff --git a/src/org/traccar/api/resource/ServerResource.java b/src/org/traccar/api/resource/ServerResource.java
index ffe6745f4..2c0373c62 100644
--- a/src/org/traccar/api/resource/ServerResource.java
+++ b/src/org/traccar/api/resource/ServerResource.java
@@ -18,19 +18,14 @@ package org.traccar.api.resource;
import org.traccar.Context;
import org.traccar.api.BaseResource;
import org.traccar.model.Server;
-import org.traccar.model.User;
import javax.annotation.security.PermitAll;
-import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
-import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
-import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import java.sql.SQLException;
@Path("server")
diff --git a/src/org/traccar/api/resource/SessionResource.java b/src/org/traccar/api/resource/SessionResource.java
index 53e29802c..554b6760e 100644
--- a/src/org/traccar/api/resource/SessionResource.java
+++ b/src/org/traccar/api/resource/SessionResource.java
@@ -27,7 +27,6 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
@@ -42,13 +41,13 @@ public class SessionResource extends BaseResource {
public static final String USER_ID_KEY = "userId";
@javax.ws.rs.core.Context
- private HttpServletRequest req;
+ private HttpServletRequest request;
@PermitAll
@GET
public User get() {
try {
- Long userId = (Long) req.getSession().getAttribute(USER_ID_KEY);
+ Long userId = (Long) request.getSession().getAttribute(USER_ID_KEY);
if (userId != null) {
return Context.getDataManager().getUser(userId);
} else {
@@ -65,7 +64,7 @@ public class SessionResource extends BaseResource {
try {
User user = Context.getDataManager().login(email, password);
if (user != null) {
- req.getSession().setAttribute(USER_ID_KEY, user.getId());
+ request.getSession().setAttribute(USER_ID_KEY, user.getId());
return user;
} else {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
@@ -77,7 +76,7 @@ public class SessionResource extends BaseResource {
@DELETE
public Response remove() {
- req.getSession().removeAttribute(USER_ID_KEY);
+ request.getSession().removeAttribute(USER_ID_KEY);
return Response.noContent().build();
}