Package com.onlinepayments
Interface Communicator
- All Superinterfaces:
AutoCloseable,Closeable,LoggingCapable,ObfuscationCapable
- All Known Implementing Classes:
DefaultCommunicator
Used to communicate with the Online Payments platform web services.
It contains all the logic to transform a request object to a HTTP request and a HTTP response to a response object.
Thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptionvoidUtility method that delegates the call to this communicator's connection if that's an instance ofPooledConnection.voidcloseIdleConnections(long idleTime, TimeUnit timeUnit) Utility method that delegates the call to this communicator's connection if that's an instance ofPooledConnection.voiddelete(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, BodyHandler bodyHandler, CallContext context) Corresponds to the HTTP DELETE method.<O> Odelete(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Class<O> responseType, CallContext context) Corresponds to the HTTP DELETE method.voidget(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, BodyHandler bodyHandler, CallContext context) Corresponds to the HTTP GET method.<O> Oget(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Class<O> responseType, CallContext context) Corresponds to the HTTP GET method.voidpost(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Object requestBody, BodyHandler bodyHandler, CallContext context) Corresponds to the HTTP POST method.<O> Opost(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Object requestBody, Class<O> responseType, CallContext context) Corresponds to the HTTP POST method.voidput(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Object requestBody, BodyHandler bodyHandler, CallContext context) Corresponds to the HTTP PUT method.<O> Oput(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Object requestBody, Class<O> responseType, CallContext context) Corresponds to the HTTP PUT method.Methods inherited from interface com.onlinepayments.logging.LoggingCapable
disableLogging, enableLoggingMethods inherited from interface com.onlinepayments.logging.ObfuscationCapable
setBodyObfuscator, setHeaderObfuscator
-
Method Details
-
get
<O> O get(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Class<O> responseType, CallContext context) Corresponds to the HTTP GET method.- Parameters:
relativePath- The path to call, relative to the base URI.requestHeaders- An optional list of request headers.requestParameters- An optional set of request parameters.responseType- The type of response to return.context- The optional call context to use.- Throws:
CommunicationException- when an exception occurred communicating with the Online Payments platformResponseException- when an error response was received from the Online Payments platform
-
get
void get(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, BodyHandler bodyHandler, CallContext context) Corresponds to the HTTP GET method.- Parameters:
relativePath- The path to call, relative to the base URI.requestHeaders- An optional list of request headers.requestParameters- An optional set of request parameters.bodyHandler- The handler for the response body.context- The optional call context to use.- Throws:
CommunicationException- when an exception occurred communicating with the Online Payments platformResponseException- when an error response was received from the Online Payments platform
-
delete
<O> O delete(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Class<O> responseType, CallContext context) Corresponds to the HTTP DELETE method.- Parameters:
relativePath- The path to call, relative to the base URI.requestHeaders- An optional list of request headers.requestParameters- An optional set of request parameters.responseType- The type of response to return.context- The optional call context to use.- Throws:
CommunicationException- when an exception occurred communicating with the Online Payments platformResponseException- when an error response was received from the Online Payments platform
-
delete
void delete(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, BodyHandler bodyHandler, CallContext context) Corresponds to the HTTP DELETE method.- Parameters:
relativePath- The path to call, relative to the base URI.requestHeaders- An optional list of request headers.requestParameters- An optional set of request parameters.bodyHandler- The handler for the response body.context- The optional call context to use.- Throws:
CommunicationException- when an exception occurred communicating with the Online Payments platformResponseException- when an error response was received from the Online Payments platform
-
post
<O> O post(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Object requestBody, Class<O> responseType, CallContext context) Corresponds to the HTTP POST method.- Parameters:
relativePath- The path to call, relative to the base URI.requestHeaders- An optional list of request headers.requestParameters- An optional set of request parameters.requestBody- The optional request body to send.responseType- The type of response to return.context- The optional call context to use.- Throws:
CommunicationException- when an exception occurred communicating with the Online Payments platformResponseException- when an error response was received from the Online Payments platform
-
post
void post(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Object requestBody, BodyHandler bodyHandler, CallContext context) Corresponds to the HTTP POST method.- Parameters:
relativePath- The path to call, relative to the base URI.requestHeaders- An optional list of request headers.requestParameters- An optional set of request parameters.requestBody- The optional request body to send.bodyHandler- The handler for the response body.context- The optional call context to use.- Throws:
CommunicationException- when an exception occurred communicating with the Online Payments platformResponseException- when an error response was received from the Online Payments platform
-
put
<O> O put(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Object requestBody, Class<O> responseType, CallContext context) Corresponds to the HTTP PUT method.- Parameters:
relativePath- The path to call, relative to the base URI.requestHeaders- An optional list of request headers.requestParameters- An optional set of request parameters.requestBody- The optional request body to send.responseType- The type of response to return.context- The optional call context to use.- Throws:
CommunicationException- when an exception occurred communicating with the Online Payments platformResponseException- when an error response was received from the Online Payments platform
-
put
void put(String relativePath, List<RequestHeader> requestHeaders, ParamRequest requestParameters, Object requestBody, BodyHandler bodyHandler, CallContext context) Corresponds to the HTTP PUT method.- Parameters:
relativePath- The path to call, relative to the base URI.requestHeaders- An optional list of request headers.requestParameters- An optional set of request parameters.requestBody- The optional request body to send.bodyHandler- The handler for the response body.context- The optional call context to use.- Throws:
CommunicationException- when an exception occurred communicating with the Online Payments platformResponseException- when an error response was received from the Online Payments platform
-
getMarshaller
Marshaller getMarshaller()- Returns:
- The
Marshallerobject associated with this communicator. Nevernull.
-
closeIdleConnections
Utility method that delegates the call to this communicator's connection if that's an instance ofPooledConnection. If not this method does nothing.- See Also:
-
closeExpiredConnections
void closeExpiredConnections()Utility method that delegates the call to this communicator's connection if that's an instance ofPooledConnection. If not this method does nothing.- See Also:
-