Class DefaultHTTPMsgSender
- java.lang.Object
-
- org.certificateservices.messages.utils.BaseHTTPSender
-
- org.certificateservices.messages.utils.DefaultHTTPMsgSender
-
- All Implemented Interfaces:
MsgSender
public class DefaultHTTPMsgSender extends BaseHTTPSender implements MsgSender
DefaultHTTPMsgSender sending a byte[] array to a given URL. Created by Philip Vendil on 16/06/16.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.certificateservices.messages.utils.BaseHTTPSender
BaseHTTPSender.SendMsgRunnable, BaseHTTPSender.SynchronousCallback
-
Nested classes/interfaces inherited from interface org.certificateservices.messages.utils.MsgSender
MsgSender.MsgCallback
-
-
Field Summary
-
Fields inherited from class org.certificateservices.messages.utils.BaseHTTPSender
baseURL, outputContentType, requestType
-
-
Constructor Summary
Constructors Constructor Description DefaultHTTPMsgSender(java.lang.String url)Main constructor for POST requestsDefaultHTTPMsgSender(java.lang.String url, java.lang.String requestType)Main constructor where it is possible to specify request type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]sendMsg(byte[] request)Synchronous call for sending HTTP request sending data in the HTTP request body (usually using POST)voidsendMsg(byte[] request, MsgSender.MsgCallback callback)Asynchronous call for sending HTTP request sending data in the HTTP request body (usually using POST)-
Methods inherited from class org.certificateservices.messages.utils.BaseHTTPSender
sendMsg, sendMsg, testConnection
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.certificateservices.messages.utils.MsgSender
testConnection
-
-
-
-
Constructor Detail
-
DefaultHTTPMsgSender
public DefaultHTTPMsgSender(java.lang.String url) throws java.net.MalformedURLExceptionMain constructor for POST requests- Parameters:
url- the URL to connect to.- Throws:
java.net.MalformedURLException- if URL was malformed.
-
DefaultHTTPMsgSender
public DefaultHTTPMsgSender(java.lang.String url, java.lang.String requestType) throws java.net.MalformedURLExceptionMain constructor where it is possible to specify request type.- Parameters:
url- the URL to connect to.requestType- the HTTP request type in upper case (For example POST, GET)- Throws:
java.net.MalformedURLException- if URL was malformed.
-
-
Method Detail
-
sendMsg
public byte[] sendMsg(byte[] request) throws MessageContentException, MessageProcessingException, java.io.IOException, SpamProtectionException, TimeoutExceptionDescription copied from class:BaseHTTPSenderSynchronous call for sending HTTP request sending data in the HTTP request body (usually using POST)- Specified by:
sendMsgin interfaceMsgSender- Overrides:
sendMsgin classBaseHTTPSender- Parameters:
request- the data to send.- Returns:
- the response data.
- Throws:
MessageContentException- if request contained illegal content.MessageProcessingException- if internal problems occurred processing the request at the server.TimeoutException- if timeout was detected when calling service.java.io.IOException- if communication problems occurred.SpamProtectionException- if server side regarded call as a SPAM request and denied it.
-
sendMsg
public void sendMsg(byte[] request, MsgSender.MsgCallback callback)Description copied from class:BaseHTTPSenderAsynchronous call for sending HTTP request sending data in the HTTP request body (usually using POST)- Specified by:
sendMsgin interfaceMsgSender- Overrides:
sendMsgin classBaseHTTPSender- Parameters:
request- the data to send.callback- the callback to signal the result to.
-
-