Class HttpClientRestClient
java.lang.Object
org.sourcelab.kafka.connect.apiclient.rest.HttpClientRestClient
- All Implemented Interfaces:
RestClient
RestClient implementation using HTTPClient.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.HttpClientRestClient(HttpClientConfigHooks configHooks) Constructor allowing for injecting configuration hooks. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Called to release any internally held resources.protected org.apache.http.impl.client.HttpClientBuilderCreate the HttpClientBuilder which is used to create the HttpClient.voidinit(Configuration configuration) Initialization method.submitRequest(Request request) Make a request against the Pardot API.
-
Constructor Details
-
HttpClientRestClient
public HttpClientRestClient()Constructor. -
HttpClientRestClient
Constructor allowing for injecting configuration hooks.- Parameters:
configHooks- For hooking/overriding into how the underlying HttpClient is configured.
-
-
Method Details
-
init
Initialization method. This takes in the configuration and sets up the underlying http client appropriately.- Specified by:
initin interfaceRestClient- Parameters:
configuration- The user defined configuration.
-
close
public void close()Description copied from interface:RestClientCalled to release any internally held resources.- Specified by:
closein interfaceRestClient
-
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
Make a request against the Pardot API.- Specified by:
submitRequestin interfaceRestClient- Parameters:
request- The request to submit.- Returns:
- The response, in UTF-8 String format.
- Throws:
RestException- if something goes wrong.
-