public class GatewaySmsSender
extends java.lang.Object
implements org.cyclos.impl.utils.sms.SmsSender
| Modifier and Type | Field and Description |
|---|---|
protected static int |
TIMEOUT |
| Constructor and Description |
|---|
GatewaySmsSender() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyAuthentication(ConfigurationAccessor configuration,
MobilePhone phone,
java.lang.String phoneNumber,
java.lang.String message,
org.apache.http.client.methods.HttpUriRequest request)
May be overridden in order to use some custom authentication scheme
|
protected void |
applyPostBody(ConfigurationAccessor configuration,
MobilePhone phone,
java.lang.String phoneNumber,
java.lang.String message,
org.apache.http.client.methods.HttpPost request,
java.lang.String postBody) |
protected org.apache.http.client.methods.HttpUriRequest |
buildRequest(ConfigurationAccessor configuration,
java.lang.String gatewayUrl,
MobilePhone phone,
java.lang.String phoneNumber,
java.lang.String message)
Creates the request, either a GET or post, and sets the content type header on it
|
protected OutboundSmsStatus |
doSend(ConfigurationAccessor configuration,
MobilePhone phone,
java.lang.String phoneNumber,
java.lang.String message,
org.apache.http.client.methods.HttpUriRequest request)
May be overriden in order to customize the SMS sending
|
protected java.lang.String |
preProcessMessage(ConfigurationAccessor configuration,
java.lang.String message)
By default, according to the outbound sms configuration, makes the message only have ASC-II characters
|
protected java.lang.String |
resolveGatewayUrl(ConfigurationAccessor configuration,
MobilePhone phone,
java.lang.String phoneNumber,
java.lang.String message,
java.util.Map<java.lang.String,java.lang.String> variables)
May be overridden in order to resolve the final gateway URL.
|
protected java.lang.String |
resolvePostBody(ConfigurationAccessor configuration,
MobilePhone phone,
java.lang.String phoneNumber,
java.lang.String message,
java.util.Map<java.lang.String,java.lang.String> variables)
May be overridden in order to resolve the POST body from the given context and variables
|
protected OutboundSmsStatus |
resolveStatus(ConfigurationAccessor configuration,
MobilePhone phone,
java.lang.String message,
org.apache.http.client.methods.HttpUriRequest request,
int statusCode,
org.apache.http.HttpEntity entity)
May be overridden to actually resolve the SMS status from the given response
|
protected java.util.Map<java.lang.String,java.lang.String> |
resolveVariables(ConfigurationAccessor configuration,
MobilePhone phone,
java.lang.String phoneNumber,
java.lang.String message)
May be overridden in order to resolve custom variables
|
OutboundSmsStatus |
send(ConfigurationAccessor configuration,
MobilePhone phone,
java.lang.String phoneNumber,
java.lang.String message) |
protected static final int TIMEOUT
public OutboundSmsStatus send(ConfigurationAccessor configuration, @Nullable MobilePhone phone, java.lang.String phoneNumber, java.lang.String message)
send in interface org.cyclos.impl.utils.sms.SmsSenderprotected void applyAuthentication(ConfigurationAccessor configuration, @Nullable MobilePhone phone, java.lang.String phoneNumber, java.lang.String message, org.apache.http.client.methods.HttpUriRequest request) throws java.lang.Exception
java.lang.Exceptionprotected void applyPostBody(ConfigurationAccessor configuration, @Nullable MobilePhone phone, java.lang.String phoneNumber, java.lang.String message, org.apache.http.client.methods.HttpPost request, java.lang.String postBody)
protected org.apache.http.client.methods.HttpUriRequest buildRequest(ConfigurationAccessor configuration, java.lang.String gatewayUrl, @Nullable MobilePhone phone, java.lang.String phoneNumber, java.lang.String message)
protected OutboundSmsStatus doSend(ConfigurationAccessor configuration, @Nullable MobilePhone phone, java.lang.String phoneNumber, java.lang.String message, org.apache.http.client.methods.HttpUriRequest request) throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String preProcessMessage(ConfigurationAccessor configuration, java.lang.String message)
protected java.lang.String resolveGatewayUrl(ConfigurationAccessor configuration, @Nullable MobilePhone phone, java.lang.String phoneNumber, java.lang.String message, java.util.Map<java.lang.String,java.lang.String> variables) throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String resolvePostBody(ConfigurationAccessor configuration, @Nullable MobilePhone phone, java.lang.String phoneNumber, java.lang.String message, java.util.Map<java.lang.String,java.lang.String> variables) throws java.lang.Exception
java.lang.Exceptionprotected OutboundSmsStatus resolveStatus(ConfigurationAccessor configuration, @Nullable MobilePhone phone, java.lang.String message, org.apache.http.client.methods.HttpUriRequest request, int statusCode, org.apache.http.HttpEntity entity)
protected java.util.Map<java.lang.String,java.lang.String> resolveVariables(ConfigurationAccessor configuration, @Nullable MobilePhone phone, java.lang.String phoneNumber, java.lang.String message) throws java.lang.Exception
java.lang.Exception