From d8d5f0277a342e7254c465d209725dd362554e58 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 4 Nov 2018 11:32:55 +1300 Subject: Fix issue with SMS events --- src/org/traccar/sms/HttpSmsClient.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') 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() { + @Override + public void completed(String s) { + } + + @Override + public void failed(Throwable throwable) { + LOGGER.warn("SMS send failed", throwable); + } + }); } } -- cgit v1.2.3