diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/Context.java | 9 |
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; } |