aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-11-04 11:32:55 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-11-04 11:32:55 +1300
commitd8d5f0277a342e7254c465d209725dd362554e58 (patch)
tree50ac71d0f0608655d8362ad3699893c5b5b0d904 /src
parentf917c5915cbf08f82c249e31eb4a99c2559cf9f8 (diff)
downloadtraccar-server-d8d5f0277a342e7254c465d209725dd362554e58.tar.gz
traccar-server-d8d5f0277a342e7254c465d209725dd362554e58.tar.bz2
traccar-server-d8d5f0277a342e7254c465d209725dd362554e58.zip
Fix issue with SMS events
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/sms/HttpSmsClient.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/org/traccar/sms/HttpSmsClient.java b/src/org/traccar/sms/HttpSmsClient.java
index e14099772..3f7bc3c85 100644
--- a/src/org/traccar/sms/HttpSmsClient.java
+++ b/src/org/traccar/sms/HttpSmsClient.java
@@ -18,8 +18,12 @@ package org.traccar.sms;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.InvocationCallback;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.traccar.Context;
import org.traccar.api.SecurityRequestFilter;
import org.traccar.helper.DataConverter;
@@ -31,6 +35,8 @@ import java.nio.charset.StandardCharsets;
public class HttpSmsClient implements SmsManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(HttpSmsClient.class);
+
private String url;
private String authorization;
private String template;
@@ -84,7 +90,17 @@ public class HttpSmsClient implements SmsManager {
@Override
public void sendMessageAsync(final String destAddress, final String message, final boolean command) {
- getRequestBuilder().async().post(Entity.json(preparePayload(destAddress, message)));
+ getRequestBuilder().async().post(
+ Entity.entity(preparePayload(destAddress, message), mediaType), new InvocationCallback<String>() {
+ @Override
+ public void completed(String s) {
+ }
+
+ @Override
+ public void failed(Throwable throwable) {
+ LOGGER.warn("SMS send failed", throwable);
+ }
+ });
}
}