Skip to main content

Customizing HttpClient

Several methods are provided for customizing the underlying HTTP client and client builder classes:

RestClient.BuilderhttpClientBuilder(HttpClientBuilder) - Set the client builder yourself.createHttpClientBuilder() - Override to create the client builder.createHttpClient() - Override to create the client.createConnectionManager() - Override to create the connection management.

Additionally, all methods on the HttpClientBuilder class have been extended with fluent setters.

Example
// Create a client with customized HttpClient settings.
MyBean bean = RestClient
.create()
.disableRedirectHandling()
.connectionManager(myConnectionManager)
.addInterceptorFirst(myHttpRequestInterceptor)
.build();

Refer to the HttpClientBuilder docs for more information.