aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-20 00:39:18 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-12-20 00:39:18 +1300
commit611a0e8f820746fd1f8ab9c1c880910639959cdc (patch)
tree5475aee7b52537a23ec01a153d4f3c24773097da /src
parent24744b34a34eaedd4a02f283b4707738802e9905 (diff)
downloadtrackermap-server-611a0e8f820746fd1f8ab9c1c880910639959cdc.tar.gz
trackermap-server-611a0e8f820746fd1f8ab9c1c880910639959cdc.tar.bz2
trackermap-server-611a0e8f820746fd1f8ab9c1c880910639959cdc.zip
Fix issue with JSON timestamps
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/Context.java3
-rw-r--r--src/org/traccar/api/ObjectMapperProvider.java11
2 files changed, 6 insertions, 8 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 6983e32f6..5d6e14efc 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.SerializationFeature;
import com.ning.http.client.AsyncHttpClient;
import java.net.InetAddress;
@@ -189,6 +190,8 @@ public final class Context {
}
objectMapper = new ObjectMapper();
+ objectMapper.setConfig(
+ objectMapper.getSerializationConfig().without(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS));
if (config.hasKey("database.url")) {
dataManager = new DataManager(config);
diff --git a/src/org/traccar/api/ObjectMapperProvider.java b/src/org/traccar/api/ObjectMapperProvider.java
index c916c1f4c..0d361ea19 100644
--- a/src/org/traccar/api/ObjectMapperProvider.java
+++ b/src/org/traccar/api/ObjectMapperProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ package org.traccar.api;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.traccar.Context;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
@@ -24,15 +25,9 @@ import javax.ws.rs.ext.Provider;
@Provider
public class ObjectMapperProvider implements ContextResolver<ObjectMapper> {
- private ObjectMapper mapper = new ObjectMapper();
-
- public ObjectMapperProvider() {
- mapper.setConfig(mapper.getSerializationConfig().without(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS));
- }
-
@Override
public ObjectMapper getContext(Class<?> type) {
- return mapper;
+ return Context.getObjectMapper();
}
}