diff options
Diffstat (limited to 'src/org/traccar/MainModule.java')
-rw-r--r-- | src/org/traccar/MainModule.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/org/traccar/MainModule.java b/src/org/traccar/MainModule.java index 40933aba5..26bdfcd60 100644 --- a/src/org/traccar/MainModule.java +++ b/src/org/traccar/MainModule.java @@ -18,7 +18,9 @@ package org.traccar; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.inject.AbstractModule; import com.google.inject.Provides; +import com.google.inject.Singleton; import org.traccar.config.Config; +import org.traccar.config.Keys; import org.traccar.database.IdentityManager; import javax.ws.rs.client.Client; @@ -45,4 +47,20 @@ public class MainModule extends AbstractModule { return Context.getClient(); } + @Singleton + @Provides + public static WebDataHandler provideWebDataHandler( + Config config, IdentityManager identityManager, ObjectMapper objectMapper, Client client) { + if (config.getBoolean(Keys.FORWARD_ENABLE)) { + return new WebDataHandler(config, identityManager, objectMapper, client); + } else { + return null; + } + } + + @Override + protected void configure() { + binder().requireExplicitBindings(); + } + } |