Interface Apache5HttpClient.Builder
-
- All Superinterfaces:
Buildable,SdkBuilder<Apache5HttpClient.Builder,SdkHttpClient>,SdkHttpClient.Builder<Apache5HttpClient.Builder>
- Enclosing class:
- Apache5HttpClient
public static interface Apache5HttpClient.Builder extends SdkHttpClient.Builder<Apache5HttpClient.Builder>
Builder for creating an instance ofSdkHttpClient. The factory can be configured through the builderApache5HttpClient.builder(), once built it can create aSdkHttpClientviaSdkHttpClient.Builder.build()or can be passed to the SDK client builders directly to have the SDK create and manage the HTTP client. See documentation on the service's respective client builder for more information on configuring the HTTP layer.SdkHttpClient httpClient = Apache5HttpClient.builder() .socketTimeout(Duration.ofSeconds(10)) .build();
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Apache5HttpClient.BuilderauthSchemeRegistry(org.apache.hc.core5.http.config.Registry<org.apache.hc.client5.http.auth.AuthSchemeFactory> authSchemeRegistry)Configure the authentication scheme registry that can be used to obtain the corresponding authentication scheme implementation for a given type of authorization challenge.Apache5HttpClient.BuilderconnectionAcquisitionTimeout(Duration connectionAcquisitionTimeout)The amount of time to wait when acquiring a connection from the pool before giving up and timing out.Apache5HttpClient.BuilderconnectionMaxIdleTime(Duration maxIdleConnectionTimeout)Configure the maximum amount of time that a connection should be allowed to remain open while idle.Apache5HttpClient.BuilderconnectionTimeout(Duration connectionTimeout)The amount of time to wait when initially establishing a connection before giving up and timing out.Apache5HttpClient.BuilderconnectionTimeToLive(Duration connectionTimeToLive)The maximum amount of time that a connection should be allowed to remain open, regardless of usage frequency.Apache5HttpClient.BuildercredentialsProvider(org.apache.hc.client5.http.auth.CredentialsProvider credentialsProvider)Configuration that defines a custom credential provider for HTTP requests.Apache5HttpClient.BuilderdnsResolver(org.apache.hc.client5.http.DnsResolver dnsResolver)Configuration that defines a DNS resolver.Apache5HttpClient.BuilderexpectContinueEnabled(Boolean expectContinueEnabled)Configure whether the client should send an HTTP expect-continue handshake before each request.Apache5HttpClient.BuilderhttpRoutePlanner(org.apache.hc.client5.http.routing.HttpRoutePlanner proxyConfiguration)Configuration that defines an HTTP route planner that computes the route an HTTP request should take.Apache5HttpClient.BuilderlocalAddress(InetAddress localAddress)Configure the local address that the HTTP client should use for communication.Apache5HttpClient.BuildermaxConnections(Integer maxConnections)The maximum number of connections allowed in the connection pool.Apache5HttpClient.BuilderproxyConfiguration(ProxyConfiguration proxyConfiguration)Configuration that defines how to communicate via an HTTP proxy.Apache5HttpClient.BuildersocketTimeout(Duration socketTimeout)The amount of time to wait for data to be transferred over an established, open connection before the connection is timed out.Apache5HttpClient.BuildertcpKeepAlive(Boolean keepConnectionAlive)Configure whether to enable or disable TCP KeepAlive.Apache5HttpClient.BuildertlsKeyManagersProvider(TlsKeyManagersProvider tlsKeyManagersProvider)Configure theTlsKeyManagersProviderthat will provide theKeyManagers to use when constructing the SSL context.Apache5HttpClient.BuildertlsSocketStrategy(org.apache.hc.client5.http.ssl.TlsSocketStrategy tlsSocketStrategy)Configure a custom TLS strategy for SSL/TLS connections.Apache5HttpClient.BuildertlsTrustManagersProvider(TlsTrustManagersProvider tlsTrustManagersProvider)Configure theTlsTrustManagersProviderthat will provide theTrustManagers to use when constructing the SSL context.Apache5HttpClient.BuilderuseIdleConnectionReaper(Boolean useConnectionReaper)Configure whether the idle connections in the connection pool should be closed asynchronously.-
Methods inherited from interface software.amazon.awssdk.utils.builder.SdkBuilder
applyMutation
-
Methods inherited from interface software.amazon.awssdk.http.SdkHttpClient.Builder
build, buildWithDefaults
-
-
-
-
Method Detail
-
socketTimeout
Apache5HttpClient.Builder socketTimeout(Duration socketTimeout)
The amount of time to wait for data to be transferred over an established, open connection before the connection is timed out. A duration of 0 means infinity, and is not recommended.
-
connectionTimeout
Apache5HttpClient.Builder connectionTimeout(Duration connectionTimeout)
The amount of time to wait when initially establishing a connection before giving up and timing out. A duration of 0 means infinity, and is not recommended.
-
connectionAcquisitionTimeout
Apache5HttpClient.Builder connectionAcquisitionTimeout(Duration connectionAcquisitionTimeout)
The amount of time to wait when acquiring a connection from the pool before giving up and timing out.- Parameters:
connectionAcquisitionTimeout- the timeout duration- Returns:
- this builder for method chaining.
-
maxConnections
Apache5HttpClient.Builder maxConnections(Integer maxConnections)
The maximum number of connections allowed in the connection pool. Each built HTTP client has its own private connection pool.
-
proxyConfiguration
Apache5HttpClient.Builder proxyConfiguration(ProxyConfiguration proxyConfiguration)
Configuration that defines how to communicate via an HTTP proxy.
-
localAddress
Apache5HttpClient.Builder localAddress(InetAddress localAddress)
Configure the local address that the HTTP client should use for communication.
-
expectContinueEnabled
Apache5HttpClient.Builder expectContinueEnabled(Boolean expectContinueEnabled)
Configure whether the client should send an HTTP expect-continue handshake before each request.
-
connectionTimeToLive
Apache5HttpClient.Builder connectionTimeToLive(Duration connectionTimeToLive)
The maximum amount of time that a connection should be allowed to remain open, regardless of usage frequency.Note: A duration of 0 is treated as infinite to maintain backward compatibility with Apache 4.x behavior. The SDK handles this internally by not setting the TTL when the value is 0.
-
connectionMaxIdleTime
Apache5HttpClient.Builder connectionMaxIdleTime(Duration maxIdleConnectionTimeout)
Configure the maximum amount of time that a connection should be allowed to remain open while idle.
-
useIdleConnectionReaper
Apache5HttpClient.Builder useIdleConnectionReaper(Boolean useConnectionReaper)
Configure whether the idle connections in the connection pool should be closed asynchronously.When enabled, connections left idling for longer than
connectionMaxIdleTime(Duration)will be closed. This will not close connections currently in use. By default, this is enabled.
-
dnsResolver
Apache5HttpClient.Builder dnsResolver(org.apache.hc.client5.http.DnsResolver dnsResolver)
Configuration that defines a DNS resolver. If no matches are found, the default resolver is used.
-
tlsSocketStrategy
Apache5HttpClient.Builder tlsSocketStrategy(org.apache.hc.client5.http.ssl.TlsSocketStrategy tlsSocketStrategy)
Configure a custom TLS strategy for SSL/TLS connections. This is the preferred method over the ConnectionSocketFactory.- Parameters:
tlsSocketStrategy- The TLS strategy to use for upgrading connections to TLS. If null, default TLS configuration will be used.- Returns:
- This builder for method chaining
-
httpRoutePlanner
Apache5HttpClient.Builder httpRoutePlanner(org.apache.hc.client5.http.routing.HttpRoutePlanner proxyConfiguration)
Configuration that defines an HTTP route planner that computes the route an HTTP request should take. May not be used in conjunction withproxyConfiguration(ProxyConfiguration).
-
credentialsProvider
Apache5HttpClient.Builder credentialsProvider(org.apache.hc.client5.http.auth.CredentialsProvider credentialsProvider)
Configuration that defines a custom credential provider for HTTP requests. May not be used in conjunction withProxyConfiguration.username()andProxyConfiguration.password().
-
tcpKeepAlive
Apache5HttpClient.Builder tcpKeepAlive(Boolean keepConnectionAlive)
Configure whether to enable or disable TCP KeepAlive. The configuration will be passed to the socket optionSocketOptions.SO_KEEPALIVE.By default, this is disabled.
When enabled, the actual KeepAlive mechanism is dependent on the Operating System and therefore additional TCP KeepAlive values (like timeout, number of packets, etc) must be configured via the Operating System (sysctl on Linux/Mac, and Registry values on Windows).
-
tlsKeyManagersProvider
Apache5HttpClient.Builder tlsKeyManagersProvider(TlsKeyManagersProvider tlsKeyManagersProvider)
Configure theTlsKeyManagersProviderthat will provide theKeyManagers to use when constructing the SSL context.The default used by the client will be
SystemPropertyTlsKeyManagersProvider. Configure an instance ofNoneTlsKeyManagersProvideror another implementation ofTlsKeyManagersProviderto override it.
-
tlsTrustManagersProvider
Apache5HttpClient.Builder tlsTrustManagersProvider(TlsTrustManagersProvider tlsTrustManagersProvider)
Configure theTlsTrustManagersProviderthat will provide theTrustManagers to use when constructing the SSL context.
-
authSchemeRegistry
Apache5HttpClient.Builder authSchemeRegistry(org.apache.hc.core5.http.config.Registry<org.apache.hc.client5.http.auth.AuthSchemeFactory> authSchemeRegistry)
Configure the authentication scheme registry that can be used to obtain the corresponding authentication scheme implementation for a given type of authorization challenge.
-
-