diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-11 14:27:01 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-11 14:27:01 -0700 |
commit | 4025a42c42e34bb620f4263de05781a10ddc7a9d (patch) | |
tree | 56ec382fcb2ad9089556ab3e17f3d9e76a8ec71e /src/main/java/org/traccar/web/WebServer.java | |
parent | aa00ed23f96f91cfc879f02e61333511e3b7b11b (diff) | |
download | trackermap-server-4025a42c42e34bb620f4263de05781a10ddc7a9d.tar.gz trackermap-server-4025a42c42e34bb620f4263de05781a10ddc7a9d.tar.bz2 trackermap-server-4025a42c42e34bb620f4263de05781a10ddc7a9d.zip |
Inject object mapper
Diffstat (limited to 'src/main/java/org/traccar/web/WebServer.java')
-rw-r--r-- | src/main/java/org/traccar/web/WebServer.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/web/WebServer.java b/src/main/java/org/traccar/web/WebServer.java index fdbfc1464..933e8c845 100644 --- a/src/main/java/org/traccar/web/WebServer.java +++ b/src/main/java/org/traccar/web/WebServer.java @@ -15,6 +15,7 @@ */ package org.traccar.web; +import com.google.inject.Injector; import com.google.inject.servlet.GuiceFilter; import org.eclipse.jetty.http.HttpCookie; import org.eclipse.jetty.http.HttpMethod; @@ -78,10 +79,12 @@ public class WebServer implements LifecycleObject { private static final Logger LOGGER = LoggerFactory.getLogger(WebServer.class); + private final Injector injector; private final Server server; @Inject - public WebServer(Config config) { + public WebServer(Injector injector, Config config) { + this.injector = injector; String address = config.getString(Keys.WEB_ADDRESS); int port = config.getInteger(Keys.WEB_PORT); if (address == null) { @@ -169,7 +172,7 @@ public class WebServer implements LifecycleObject { private void initApi(Config config, ServletContextHandler servletHandler) { servletHandler.addFilter(GuiceFilter.class, "/api/*", EnumSet.allOf(DispatcherType.class)); - servletHandler.addServlet(new ServletHolder(new AsyncSocketServlet()), "/api/socket"); + servletHandler.addServlet(new ServletHolder(injector.getInstance(AsyncSocketServlet.class)), "/api/socket"); JettyWebSocketServletContainerInitializer.configure(servletHandler, null); String mediaPath = config.getString(Keys.MEDIA_PATH); |