Class JdkHttpRestClient.Builder

java.lang.Object
org.refcodes.rest.JdkHttpRestClient.Builder
All Implemented Interfaces:
ExecutorServiceAccessor.ExecutorServiceBuilder<JdkHttpRestClient.Builder>, TrustStoreDescriptorAccessor.TrustStoreDescriptorBuilder<JdkHttpRestClient.Builder>, BaseUrlAccessor.BaseUrlBuilder<JdkHttpRestClient.Builder>, HttpClientContext.Builder<JdkHttpRestClient.Builder>
Enclosing class:
JdkHttpRestClient

Builder for constructing JdkHttpRestClient instances using a fluent and strongly typed configuration API.

The builder internally delegates to HttpClientOptions.Builder and exposes the most commonly used HTTP client configuration aspects, including:

  • base URL configuration
  • HTTPS trust store configuration
  • custom ExecutorService integration

The configured base URL acts as the canonical root URL for relative request locators issued by the JdkHttpRestClient. Relative request URLs are resolved against this configured base URL during request execution.

HTTPS trust configuration may be provided through a TrustStoreDescriptor, enabling custom trust stores for TLS secured communication.

The resulting JdkHttpRestClient instance is constructed from the accumulated HttpClientOptions.

Example:


JdkHttpRestClient theClient = JdkHttpRestClient.builder()
    .withBaseUrl( "https://localhost:8443/api" )
    .build();

The constructed client instance is not automatically opened. Invoke JdkHttpRestClient.open() or JdkHttpRestClient.withOpen() explicitly before issuing requests.

See Also: