From 8e8d58251ad623c0d7c4d7af35d92f71d36012ae Mon Sep 17 00:00:00 2001 From: Shinryuken Date: Mon, 6 Nov 2017 21:46:54 +0100 Subject: ObjectWriter for pretty-printing messaging --- src/org/traccar/Context.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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; } -- cgit v1.2.3