diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-19 08:01:20 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-19 08:01:20 +1300 |
commit | 54e738d3281a463a0ea3fcf2026c2464529a9b58 (patch) | |
tree | 65e924f480d6489a5939d2f289c354240fd68e59 /src/org/traccar/api/AsyncSocket.java | |
parent | 99f09134fb9c710114296d603c97a76f5cfb0d2a (diff) | |
download | trackermap-server-54e738d3281a463a0ea3fcf2026c2464529a9b58.tar.gz trackermap-server-54e738d3281a463a0ea3fcf2026c2464529a9b58.tar.bz2 trackermap-server-54e738d3281a463a0ea3fcf2026c2464529a9b58.zip |
Remove own JSON converter
Diffstat (limited to 'src/org/traccar/api/AsyncSocket.java')
-rw-r--r-- | src/org/traccar/api/AsyncSocket.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/org/traccar/api/AsyncSocket.java b/src/org/traccar/api/AsyncSocket.java index b12d5d252..70523d253 100644 --- a/src/org/traccar/api/AsyncSocket.java +++ b/src/org/traccar/api/AsyncSocket.java @@ -15,17 +15,16 @@ */ package org.traccar.api; +import com.fasterxml.jackson.core.JsonProcessingException; import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.WebSocketAdapter; import org.traccar.Context; import org.traccar.database.ConnectionManager; +import org.traccar.helper.Log; import org.traccar.model.Device; import org.traccar.model.Event; import org.traccar.model.Position; -import org.traccar.web.JsonConverter; -import javax.json.Json; -import javax.json.JsonObjectBuilder; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -84,11 +83,11 @@ public class AsyncSocket extends WebSocketAdapter implements ConnectionManager.U private void sendData(Map<String, Collection<?>> data) { if (!data.isEmpty() && isConnected()) { - JsonObjectBuilder json = Json.createObjectBuilder(); - for (Map.Entry<String, Collection<?>> entry : data.entrySet()) { - json.add(entry.getKey(), JsonConverter.arrayToJson(entry.getValue())); + try { + getRemote().sendString(Context.getObjectMapper().writeValueAsString(data), null); + } catch (JsonProcessingException e) { + Log.warning(e); } - getRemote().sendString(json.build().toString(), null); } } } |