diff options
author | Srk <watertext@hotmail.it> | 2017-11-20 19:55:11 +0100 |
---|---|---|
committer | Srk <watertext@hotmail.it> | 2017-11-20 19:55:11 +0100 |
commit | 0daa91ca51ecbb23a7f962fd64bfe5817f8eaa29 (patch) | |
tree | d584f67ce2c92116ecf1166c786cf6c63dfe0746 /src/org/traccar/notification | |
parent | f74749cac2709989fd627115248c7f363f77cc2b (diff) | |
download | trackermap-server-0daa91ca51ecbb23a7f962fd64bfe5817f8eaa29.tar.gz trackermap-server-0daa91ca51ecbb23a7f962fd64bfe5817f8eaa29.tar.bz2 trackermap-server-0daa91ca51ecbb23a7f962fd64bfe5817f8eaa29.zip |
Minor refactoring
Diffstat (limited to 'src/org/traccar/notification')
-rw-r--r-- | src/org/traccar/notification/EventForwarder.java | 10 | ||||
-rw-r--r-- | src/org/traccar/notification/JsonTypeEventForwarder.java | 1 | ||||
-rw-r--r-- | src/org/traccar/notification/NotificationFormatter.java | 6 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/org/traccar/notification/EventForwarder.java b/src/org/traccar/notification/EventForwarder.java index d7e0eca19..1a10d7ca2 100644 --- a/src/org/traccar/notification/EventForwarder.java +++ b/src/org/traccar/notification/EventForwarder.java @@ -15,11 +15,10 @@ */ package org.traccar.notification; -import java.nio.charset.StandardCharsets; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.ning.http.client.AsyncHttpClient.BoundRequestBuilder; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.traccar.Context; import org.traccar.helper.Log; @@ -28,8 +27,9 @@ import org.traccar.model.Event; import org.traccar.model.Geofence; import org.traccar.model.Position; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.ning.http.client.AsyncHttpClient.BoundRequestBuilder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; import com.ning.http.client.FluentCaseInsensitiveStringsMap; public abstract class EventForwarder { diff --git a/src/org/traccar/notification/JsonTypeEventForwarder.java b/src/org/traccar/notification/JsonTypeEventForwarder.java index 196a4eca5..c1e4220d0 100644 --- a/src/org/traccar/notification/JsonTypeEventForwarder.java +++ b/src/org/traccar/notification/JsonTypeEventForwarder.java @@ -9,7 +9,6 @@ public class JsonTypeEventForwarder extends EventForwarder { @Override
protected String getContentType() {
-
return "application/json; charset=utf-8";
}
diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java index ba3fdbecb..114825a83 100644 --- a/src/org/traccar/notification/NotificationFormatter.java +++ b/src/org/traccar/notification/NotificationFormatter.java @@ -88,7 +88,7 @@ public final class NotificationFormatter { public static MailMessage formatMailMessage(long userId, Event event, Position position) { String templatePath = Context.getConfig().getString("mail.templatesPath", "mail"); VelocityContext velocityContext = prepareContext(userId, event, position); - String formattedMessage = formatterLogic(velocityContext, userId, event, position, templatePath); + String formattedMessage = formatMessage(velocityContext, userId, event, position, templatePath); return new MailMessage((String) velocityContext.get("subject"), formattedMessage); } @@ -96,10 +96,10 @@ public final class NotificationFormatter { public static String formatSmsMessage(long userId, Event event, Position position) { String templatePath = Context.getConfig().getString("sms.templatesPath", "sms"); - return formatterLogic(null, userId, event, position, templatePath); + return formatMessage(null, userId, event, position, templatePath); } - private static String formatterLogic(VelocityContext vc, Long userId, Event event, Position position, + private static String formatMessage(VelocityContext vc, Long userId, Event event, Position position, String templatePath) { VelocityContext velocityContext = vc; |