aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/Context.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-11 14:27:01 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-11 14:27:01 -0700
commit4025a42c42e34bb620f4263de05781a10ddc7a9d (patch)
tree56ec382fcb2ad9089556ab3e17f3d9e76a8ec71e /src/main/java/org/traccar/Context.java
parentaa00ed23f96f91cfc879f02e61333511e3b7b11b (diff)
downloadtrackermap-server-4025a42c42e34bb620f4263de05781a10ddc7a9d.tar.gz
trackermap-server-4025a42c42e34bb620f4263de05781a10ddc7a9d.tar.bz2
trackermap-server-4025a42c42e34bb620f4263de05781a10ddc7a9d.zip
Inject object mapper
Diffstat (limited to 'src/main/java/org/traccar/Context.java')
-rw-r--r--src/main/java/org/traccar/Context.java17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/main/java/org/traccar/Context.java b/src/main/java/org/traccar/Context.java
index 68a711878..54bb2af4b 100644
--- a/src/main/java/org/traccar/Context.java
+++ b/src/main/java/org/traccar/Context.java
@@ -16,7 +16,6 @@
package org.traccar;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
import org.traccar.config.Config;
import org.traccar.config.Keys;
import org.traccar.database.BaseObjectManager;
@@ -29,7 +28,6 @@ import org.traccar.database.PermissionsManager;
import org.traccar.database.UsersManager;
import org.traccar.geocoder.Geocoder;
import org.traccar.helper.Log;
-import org.traccar.helper.SanitizerModule;
import org.traccar.model.BaseModel;
import org.traccar.model.Device;
import org.traccar.model.Group;
@@ -55,12 +53,6 @@ public final class Context {
return config;
}
- private static ObjectMapper objectMapper;
-
- public static ObjectMapper getObjectMapper() {
- return objectMapper;
- }
-
private static IdentityManager identityManager;
public static IdentityManager getIdentityManager() {
@@ -119,7 +111,7 @@ public final class Context {
@Override
public ObjectMapper getContext(Class<?> clazz) {
- return objectMapper;
+ return Main.getInjector().getInstance(ObjectMapper.class);
}
}
@@ -135,13 +127,6 @@ public final class Context {
throw e;
}
- objectMapper = new ObjectMapper();
- if (config.getBoolean(Keys.WEB_SANITIZE)) {
- objectMapper.registerModule(new SanitizerModule());
- }
- objectMapper.setConfig(
- objectMapper.getSerializationConfig().without(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS));
-
client = ClientBuilder.newClient().register(new ObjectMapperContextResolver());
if (config.hasKey(Keys.DATABASE_URL)) {