aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Context.java
diff options
context:
space:
mode:
authorShinryuken <watertext@hotmail.it>2017-11-06 21:46:54 +0100
committerGitHub <noreply@github.com>2017-11-06 21:46:54 +0100
commit8e8d58251ad623c0d7c4d7af35d92f71d36012ae (patch)
tree8a9069567628dd61bfc61c909939395675f1222c /src/org/traccar/Context.java
parentd1327cef4df28065b3d9879b07c826d6623f98e0 (diff)
downloadtrackermap-server-8e8d58251ad623c0d7c4d7af35d92f71d36012ae.tar.gz
trackermap-server-8e8d58251ad623c0d7c4d7af35d92f71d36012ae.tar.bz2
trackermap-server-8e8d58251ad623c0d7c4d7af35d92f71d36012ae.zip
ObjectWriter for pretty-printing messaging
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r--src/org/traccar/Context.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 3b24c6460..4e7246095 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -16,6 +16,7 @@
package org.traccar;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.ning.http.client.AsyncHttpClient;
@@ -96,6 +97,12 @@ public final class Context {
return objectMapper;
}
+ private static ObjectWriter objectWriterPrettyPrinter;
+
+ public static ObjectWriter getObjectWriterPrettyPrinter() {
+ return objectWriterPrettyPrinter;
+ }
+
private static IdentityManager identityManager;
public static IdentityManager getIdentityManager() {
@@ -280,6 +287,7 @@ public final class Context {
objectMapper = new ObjectMapper();
objectMapper.setConfig(
objectMapper.getSerializationConfig().without(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS));
+ objectWriterPrettyPrinter = objectMapper.writerWithDefaultPrettyPrinter();
if (config.hasKey("database.url")) {
dataManager = new DataManager(config);
@@ -416,6 +424,7 @@ public final class Context {
public static void init(IdentityManager testIdentityManager) {
config = new Config();
objectMapper = new ObjectMapper();
+ objectWriterPrettyPrinter = objectMapper.writerWithDefaultPrettyPrinter();
identityManager = testIdentityManager;
}