aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-01 10:43:42 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-01 10:43:42 +1300
commited7e73b5af4e4e84f3abd2dde73626f90de911bb (patch)
treea4700c5fd195101be96d2d884eeccf3df7a365d8
parentcefc12afe98f610aa0f266bcac4361f9ec414ee5 (diff)
downloadtrackermap-server-ed7e73b5af4e4e84f3abd2dde73626f90de911bb.tar.gz
trackermap-server-ed7e73b5af4e4e84f3abd2dde73626f90de911bb.tar.bz2
trackermap-server-ed7e73b5af4e4e84f3abd2dde73626f90de911bb.zip
Explicitly register REST filters
-rw-r--r--src/org/traccar/api/CORSResponseFilter.java2
-rw-r--r--src/org/traccar/api/SecurityRequestFilter.java2
-rw-r--r--src/org/traccar/web/WebServer.java4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/api/CORSResponseFilter.java b/src/org/traccar/api/CORSResponseFilter.java
index 039a749c4..89b49fc84 100644
--- a/src/org/traccar/api/CORSResponseFilter.java
+++ b/src/org/traccar/api/CORSResponseFilter.java
@@ -19,9 +19,7 @@ import java.io.IOException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
-import javax.ws.rs.ext.Provider;
-@Provider
public class CORSResponseFilter implements ContainerResponseFilter {
public static final String ACCESS_CONTROL_ALLOW_ORIGIN_KEY = "Access-Control-Allow-Origin";
diff --git a/src/org/traccar/api/SecurityRequestFilter.java b/src/org/traccar/api/SecurityRequestFilter.java
index 9d59cdc01..e52df661b 100644
--- a/src/org/traccar/api/SecurityRequestFilter.java
+++ b/src/org/traccar/api/SecurityRequestFilter.java
@@ -25,9 +25,7 @@ import javax.annotation.security.RolesAllowed;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.ResourceInfo;
-import javax.ws.rs.ext.Provider;
-@Provider
public class SecurityRequestFilter implements ContainerRequestFilter {
@javax.ws.rs.core.Context
diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java
index 2318c4151..675f4d489 100644
--- a/src/org/traccar/web/WebServer.java
+++ b/src/org/traccar/web/WebServer.java
@@ -27,6 +27,8 @@ import org.eclipse.jetty.webapp.WebAppContext;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.traccar.Config;
+import org.traccar.api.CORSResponseFilter;
+import org.traccar.api.SecurityRequestFilter;
import org.traccar.helper.Log;
/**
@@ -131,6 +133,8 @@ public class WebServer {
private void initRestApi() {
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.packages("org.traccar.api");
+ resourceConfig.register(SecurityRequestFilter.class);
+ resourceConfig.register(CORSResponseFilter.class);
ServletContextHandler servletHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
ServletHolder servletHolder = new ServletHolder(new ServletContainer(resourceConfig));
servletHandler.addServlet(servletHolder, "/rest/*");