diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-02-23 10:38:10 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-02-23 10:38:10 -0800 |
commit | d338b1177bcc46bb1b1bad1d8a76d6008dfe2239 (patch) | |
tree | b99a5d497656438e3807efee74655dc650d20c62 /src/org/traccar/WebDataHandler.java | |
parent | 53256c82683b82d69d72c5535527c99566a3188c (diff) | |
download | trackermap-server-d338b1177bcc46bb1b1bad1d8a76d6008dfe2239.tar.gz trackermap-server-d338b1177bcc46bb1b1bad1d8a76d6008dfe2239.tar.bz2 trackermap-server-d338b1177bcc46bb1b1bad1d8a76d6008dfe2239.zip |
Update web handler injection
Diffstat (limited to 'src/org/traccar/WebDataHandler.java')
-rw-r--r-- | src/org/traccar/WebDataHandler.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java index 572252a22..e29e5a075 100644 --- a/src/org/traccar/WebDataHandler.java +++ b/src/org/traccar/WebDataHandler.java @@ -17,7 +17,6 @@ package org.traccar; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.inject.assistedinject.Assisted; import org.traccar.database.IdentityManager; import org.traccar.helper.Checksum; import org.traccar.model.Device; @@ -51,21 +50,15 @@ public class WebDataHandler extends BaseDataHandler { private final String header; private final boolean json; - public interface Factory { - WebDataHandler create( - @Assisted("url") String url, @Assisted("header") String header, boolean json); - } - @Inject public WebDataHandler( - IdentityManager identityManager, ObjectMapper objectMapper, Client client, - @Assisted("url") String url, @Assisted("header") String header, @Assisted boolean json) { + Config config, IdentityManager identityManager, ObjectMapper objectMapper, Client client) { this.identityManager = identityManager; this.objectMapper = objectMapper; this.client = client; - this.url = url; - this.header = header; - this.json = json; + this.url = config.getString("forward.url"); + this.header = config.getString("forward.header"); + this.json = config.getBoolean("forward.json"); } private static String formatSentence(Position position) { @@ -187,7 +180,7 @@ public class WebDataHandler extends BaseDataHandler { return position; } - protected Map<String, Object> prepareJsonPayload(Position position) { + private Map<String, Object> prepareJsonPayload(Position position) { Map<String, Object> data = new HashMap<>(); Device device = identityManager.getById(position.getDeviceId()); |