Class HttpClientRestClient

java.lang.Object
org.sourcelab.kafka.connect.apiclient.rest.HttpClientRestClient
All Implemented Interfaces:
RestClient

public class HttpClientRestClient extends Object implements RestClient
RestClient implementation using HTTPClient.
  • Constructor Details

    • HttpClientRestClient

      public HttpClientRestClient()
      Constructor.
    • HttpClientRestClient

      public HttpClientRestClient(HttpClientConfigHooks configHooks)
      Constructor allowing for injecting configuration hooks.
      Parameters:
      configHooks - For hooking/overriding into how the underlying HttpClient is configured.
  • Method Details

    • init

      public void init(Configuration configuration)
      Initialization method. This takes in the configuration and sets up the underlying http client appropriately.
      Specified by:
      init in interface RestClient
      Parameters:
      configuration - The user defined configuration.
    • close

      public void close()
      Description copied from interface: RestClient
      Called to release any internally held resources.
      Specified by:
      close in interface RestClient
    • createHttpClientBuilder

      protected org.apache.http.impl.client.HttpClientBuilder createHttpClientBuilder()
      Create the HttpClientBuilder which is used to create the HttpClient. This method allows users to extend this class and use a custom builder if needed.
      Returns:
      The HttpClientBuilder to use for creating the HttpClient.
    • submitRequest

      public RestResponse submitRequest(Request request) throws RestException
      Make a request against the Pardot API.
      Specified by:
      submitRequest in interface RestClient
      Parameters:
      request - The request to submit.
      Returns:
      The response, in UTF-8 String format.
      Throws:
      RestException - if something goes wrong.