aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/notification/EventForwarder.java
diff options
context:
space:
mode:
authorSrk <watertext@hotmail.it>2017-11-22 22:59:37 +0100
committerSrk <watertext@hotmail.it>2017-11-22 22:59:37 +0100
commit82da12c1218ca7f1e4e1562cc183cc8a059045e6 (patch)
tree923056148c8f0fc647cba3696ce4015e818df0f7 /src/org/traccar/notification/EventForwarder.java
parent906d376b4f8c199b36064a0cd58cdf9c3ccb712f (diff)
downloadtrackermap-server-82da12c1218ca7f1e4e1562cc183cc8a059045e6.tar.gz
trackermap-server-82da12c1218ca7f1e4e1562cc183cc8a059045e6.tar.bz2
trackermap-server-82da12c1218ca7f1e4e1562cc183cc8a059045e6.zip
Minor refactoring
Diffstat (limited to 'src/org/traccar/notification/EventForwarder.java')
-rw-r--r--src/org/traccar/notification/EventForwarder.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/org/traccar/notification/EventForwarder.java b/src/org/traccar/notification/EventForwarder.java
index cc83aefbc..1354901a7 100644
--- a/src/org/traccar/notification/EventForwarder.java
+++ b/src/org/traccar/notification/EventForwarder.java
@@ -20,6 +20,7 @@ import com.ning.http.client.AsyncHttpClient.BoundRequestBuilder;
import java.util.Arrays;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
import org.traccar.Context;
import org.traccar.helper.Log;
import org.traccar.model.Device;
@@ -39,7 +40,7 @@ public abstract class EventForwarder {
public EventForwarder() {
url = Context.getConfig().getString("event.forward.url", "http://localhost/");
- header = Context.getConfig().getString("event.forward.header", "");
+ header = Context.getConfig().getString("event.forward.header");
}
private static final String KEY_POSITION = "position";
@@ -54,9 +55,9 @@ public abstract class EventForwarder {
requestBuilder.addHeader("Content-Type", getContentType());
- if (!header.equals("")) {
+ if (StringUtils.isNotEmpty(header)) {
FluentCaseInsensitiveStringsMap params = new FluentCaseInsensitiveStringsMap();
- params.putAll(splitParams(header, ":"));
+ params.putAll(splitIntoKeyValues(header, ":"));
requestBuilder.setHeaders(params);
}
@@ -64,7 +65,7 @@ public abstract class EventForwarder {
requestBuilder.execute();
}
- protected Map<String, List<String>> splitParams(String params, String separator) {
+ protected Map<String, List<String>> splitIntoKeyValues(String params, String separator) {
String[] splitedLine;
Map<String, List<String>> paramsMap = new HashMap<>();