aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-24 08:06:17 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-24 08:06:17 -0700
commitc60743cfab4e31214207da5dab44fc4426d53764 (patch)
tree1a64b06d59cc7174722a28185dc74d6bb456ee9e
parentbf504bdda752dfbde1a81ece03805d14a4bd117c (diff)
downloadtrackermap-server-c60743cfab4e31214207da5dab44fc4426d53764.tar.gz
trackermap-server-c60743cfab4e31214207da5dab44fc4426d53764.tar.bz2
trackermap-server-c60743cfab4e31214207da5dab44fc4426d53764.zip
Check if resources loaded
-rw-r--r--src/main/java/org/traccar/web/WebServer.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/web/WebServer.java b/src/main/java/org/traccar/web/WebServer.java
index 6c8a798b4..68eee78e7 100644
--- a/src/main/java/org/traccar/web/WebServer.java
+++ b/src/main/java/org/traccar/web/WebServer.java
@@ -40,6 +40,8 @@ import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerI
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.traccar.LifecycleObject;
import org.traccar.api.CorsResponseFilter;
import org.traccar.api.DateParameterConverterProvider;
@@ -67,6 +69,8 @@ import java.util.EnumSet;
public class WebServer implements LifecycleObject {
+ private static final Logger LOGGER = LoggerFactory.getLogger(WebServer.class);
+
private final Injector injector;
private final Config config;
private final Server server;
@@ -180,6 +184,9 @@ public class WebServer implements LifecycleObject {
CorsResponseFilter.class,
ResourceErrorHandler.class);
resourceConfig.packages(ServerResource.class.getPackage().getName());
+ if (resourceConfig.getClasses().stream().filter(ServerResource.class::equals).findAny().isEmpty()) {
+ LOGGER.warn("Failed to load API resources");
+ }
servletHandler.addServlet(new ServletHolder(new ServletContainer(resourceConfig)), "/api/*");
}