aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/notification
diff options
context:
space:
mode:
authorSrk <watertext@hotmail.it>2017-11-19 11:13:48 +0100
committerSrk <watertext@hotmail.it>2017-11-19 11:13:48 +0100
commitc7928ef4a722cb40e9911c8e76e308fc48c85567 (patch)
tree523a51a5611d7c3038c38c8630afa90eb5948d81 /src/org/traccar/notification
parent7d2f57e2f45b8e3f92324eb4f9fd1cdd975d311c (diff)
downloadtrackermap-server-c7928ef4a722cb40e9911c8e76e308fc48c85567.tar.gz
trackermap-server-c7928ef4a722cb40e9911c8e76e308fc48c85567.tar.bz2
trackermap-server-c7928ef4a722cb40e9911c8e76e308fc48c85567.zip
- Global jsonPrettyPrinting option
- Minor refactoring - Config option name changed from "event.forward.prettyPrintedPayload" to "config.mapper.prettyPrintedJson"
Diffstat (limited to 'src/org/traccar/notification')
-rw-r--r--src/org/traccar/notification/EventForwarder.java15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/org/traccar/notification/EventForwarder.java b/src/org/traccar/notification/EventForwarder.java
index c21799d74..d7e0eca19 100644
--- a/src/org/traccar/notification/EventForwarder.java
+++ b/src/org/traccar/notification/EventForwarder.java
@@ -29,7 +29,6 @@ import org.traccar.model.Geofence;
import org.traccar.model.Position;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectWriter;
import com.ning.http.client.AsyncHttpClient.BoundRequestBuilder;
import com.ning.http.client.FluentCaseInsensitiveStringsMap;
@@ -39,14 +38,12 @@ public abstract class EventForwarder {
private String header;
private final String payloadParamName;
private final String additionalParams;
- private final boolean prettyPrinted;
public EventForwarder() {
url = Context.getConfig().getString("event.forward.url", "http://localhost/");
header = Context.getConfig().getString("event.forward.header", "");
payloadParamName = Context.getConfig().getString("event.forward.paramMode.payloadParamName", "payload");
additionalParams = Context.getConfig().getString("event.forward.paramMode.additionalParams", "");
- prettyPrinted = Context.getConfig().getBoolean("event.forward.prettyPrintedPayload");
}
private static final String KEY_POSITION = "position";
@@ -105,29 +102,19 @@ public abstract class EventForwarder {
}
}
try {
- return getObjectWriter().writeValueAsString(data);
+ return Context.getObjectMapper().writeValueAsString(data);
} catch (JsonProcessingException e) {
Log.warning(e);
return null;
}
}
- protected ObjectWriter getObjectWriter() {
- return prettyPrinted
- ? Context.getObjectWriterPrettyPrinter()
- : Context.getObjectMapper().writer();
- }
-
-
protected String getPayloadParamName() {
return payloadParamName;
}
protected String getAdditionalParams() {
return additionalParams;
}
- protected boolean isPrettyPrinted() {
- return prettyPrinted;
- }
protected abstract String getContentType();
protected abstract void setContent(Event event, Position position, BoundRequestBuilder requestBuilder);