Interface Communicator

All Superinterfaces:
AutoCloseable, Closeable, LoggingCapable, ObfuscationCapable
All Known Implementing Classes:
DefaultCommunicator

public interface Communicator extends Closeable, LoggingCapable, ObfuscationCapable
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 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 platform
      ResponseException - 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 platform
      ResponseException - 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 platform
      ResponseException - 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 platform
      ResponseException - 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 platform
      ResponseException - 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 platform
      ResponseException - 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 platform
      ResponseException - 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 platform
      ResponseException - when an error response was received from the Online Payments platform
    • getMarshaller

      Marshaller getMarshaller()
      Returns:
      The Marshaller object associated with this communicator. Never null.
    • closeIdleConnections

      void closeIdleConnections(long idleTime, TimeUnit timeUnit)
      Utility method that delegates the call to this communicator's connection if that's an instance of PooledConnection. 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 of PooledConnection. If not this method does nothing.
      See Also: