diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-12-27 13:17:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-27 13:17:28 -0500 |
commit | 3634098dc835e457b908cb941a3cd4555af4400d (patch) | |
tree | dcfeb5dd4c673e64a0720f8ec340b4d4bd484a39 /src/org | |
parent | 0c0df0ff62a4b14aba8ef2ebd8642d1ee3dd4148 (diff) | |
parent | 93d3854a62e80b54a67a4bc47722e5ca896d0afa (diff) | |
download | trackermap-server-3634098dc835e457b908cb941a3cd4555af4400d.tar.gz trackermap-server-3634098dc835e457b908cb941a3cd4555af4400d.tar.bz2 trackermap-server-3634098dc835e457b908cb941a3cd4555af4400d.zip |
Merge pull request #4170 from mujeerhashmi/msg91sms
SMS client: Changes to support msg91
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/sms/HttpSmsClient.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/sms/HttpSmsClient.java b/src/org/traccar/sms/HttpSmsClient.java index 994e2db4e..8e2b67bf7 100644 --- a/src/org/traccar/sms/HttpSmsClient.java +++ b/src/org/traccar/sms/HttpSmsClient.java @@ -38,6 +38,7 @@ public class HttpSmsClient implements SmsManager { private static final Logger LOGGER = LoggerFactory.getLogger(HttpSmsClient.class); private String url; + private String authorizationHeader; private String authorization; private String template; private boolean encode; @@ -45,6 +46,8 @@ public class HttpSmsClient implements SmsManager { public HttpSmsClient() { url = Context.getConfig().getString("sms.http.url"); + authorizationHeader = Context.getConfig().getString("sms.http.authorizationHeader", + SecurityRequestFilter.AUTHORIZATION_HEADER); authorization = Context.getConfig().getString("sms.http.authorization"); if (authorization == null) { String user = Context.getConfig().getString("sms.http.user"); @@ -70,7 +73,7 @@ public class HttpSmsClient implements SmsManager { try { return template .replace("{phone}", prepareValue(destAddress)) - .replace("{message}", prepareValue(message)); + .replace("{message}", prepareValue(message.trim())); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } @@ -78,7 +81,7 @@ public class HttpSmsClient implements SmsManager { private Invocation.Builder getRequestBuilder() { return Context.getClient().target(url).request() - .header(SecurityRequestFilter.AUTHORIZATION_HEADER, authorization); + .header(authorizationHeader, authorization); } @Override |