From 0270f5b639166b385ac779c0d2caa41d7c408771 Mon Sep 17 00:00:00 2001 From: Vitaliy Gergel Date: Wed, 4 Mar 2020 21:54:55 +0200 Subject: Adding property to enable URL parameter in json mode --- src/main/java/org/traccar/config/Keys.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/java/org/traccar/config') diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index d88b36d28..a5b7b780c 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -100,6 +100,13 @@ public final class Keys { public static final ConfigKey FORWARD_JSON = new ConfigKey( "forward.json", Boolean.class); + /** + * Boolean value to enable URL parameters in json mode. For example, {uniqueId} for device identifier, + * {latitude} and {longitude} for coordinates. + */ + public static final ConfigKey FORWARD_JSON_URL_VARIABLES = new ConfigKey( + "forward.json.url.variables", Boolean.class); + /** * Position forwarding retrying enable. When enabled, additional attempts are made to deliver positions. If initial * delivery fails, because of an unreachable server or an HTTP response different from '2xx', the software waits -- cgit v1.2.3 From 3c82764799784d3d30d969dbfef9a075f4874278 Mon Sep 17 00:00:00 2001 From: Vitaliy Gergel Date: Thu, 5 Mar 2020 22:22:59 +0200 Subject: Rename forward.urlVariables property --- src/main/java/org/traccar/WebDataHandler.java | 6 +++--- src/main/java/org/traccar/config/Keys.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/org/traccar/config') diff --git a/src/main/java/org/traccar/WebDataHandler.java b/src/main/java/org/traccar/WebDataHandler.java index 1af1af48a..d6bfb126b 100644 --- a/src/main/java/org/traccar/WebDataHandler.java +++ b/src/main/java/org/traccar/WebDataHandler.java @@ -67,7 +67,7 @@ public class WebDataHandler extends BaseDataHandler { private final String url; private final String header; private final boolean json; - private final boolean jsonUrlVariables; + private final boolean urlVariables; private final boolean retryEnabled; private final int retryDelay; @@ -86,7 +86,7 @@ public class WebDataHandler extends BaseDataHandler { this.url = config.getString(Keys.FORWARD_URL); this.header = config.getString(Keys.FORWARD_HEADER); this.json = config.getBoolean(Keys.FORWARD_JSON); - this.jsonUrlVariables = config.getBoolean(Keys.FORWARD_JSON_URL_VARIABLES); + this.urlVariables = config.getBoolean(Keys.FORWARD_URL_VARIABLES); this.retryEnabled = config.getBoolean(Keys.FORWARD_RETRY_ENABLE); this.retryDelay = config.getInteger(Keys.FORWARD_RETRY_DELAY, 100); @@ -194,7 +194,7 @@ public class WebDataHandler extends BaseDataHandler { String formattedUrl; try { - formattedUrl = (json && !jsonUrlVariables) ? url : formatRequest(position); + formattedUrl = (json && !urlVariables) ? url : formatRequest(position); } catch (UnsupportedEncodingException | JsonProcessingException e) { throw new RuntimeException("Forwarding formatting error", e); } diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index a5b7b780c..200ef8aa3 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -104,8 +104,8 @@ public final class Keys { * Boolean value to enable URL parameters in json mode. For example, {uniqueId} for device identifier, * {latitude} and {longitude} for coordinates. */ - public static final ConfigKey FORWARD_JSON_URL_VARIABLES = new ConfigKey( - "forward.json.url.variables", Boolean.class); + public static final ConfigKey FORWARD_URL_VARIABLES = new ConfigKey( + "forward.urlVariables", Boolean.class); /** * Position forwarding retrying enable. When enabled, additional attempts are made to deliver positions. If initial -- cgit v1.2.3