Interface ApacheHttpClient.Builder
-
- All Superinterfaces:
Buildable
,SdkBuilder<ApacheHttpClient.Builder,SdkHttpClient>
,SdkHttpClient.Builder<ApacheHttpClient.Builder>
- Enclosing class:
- ApacheHttpClient
public static interface ApacheHttpClient.Builder extends SdkHttpClient.Builder<ApacheHttpClient.Builder>
Builder for creating an instance ofSdkHttpClient
. The factory can be configured through the builderApacheHttpClient.builder()
, once built it can create aSdkHttpClient
viaSdkHttpClient.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 = ApacheHttpClient.builder() .socketTimeout(Duration.ofSeconds(10)) .build();
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ApacheHttpClient.Builder
connectionAcquisitionTimeout(Duration connectionAcquisitionTimeout)
The amount of time to wait when acquiring a connection from the pool before giving up and timing out.ApacheHttpClient.Builder
connectionMaxIdleTime(Duration maxIdleConnectionTimeout)
Configure the maximum amount of time that a connection should be allowed to remain open while idle.ApacheHttpClient.Builder
connectionTimeout(Duration connectionTimeout)
The amount of time to wait when initially establishing a connection before giving up and timing out.ApacheHttpClient.Builder
connectionTimeToLive(Duration connectionTimeToLive)
The maximum amount of time that a connection should be allowed to remain open, regardless of usage frequency.ApacheHttpClient.Builder
credentialsProvider(org.apache.http.client.CredentialsProvider credentialsProvider)
Configuration that defines a custom credential provider for HTTP requests.ApacheHttpClient.Builder
dnsResolver(org.apache.http.conn.DnsResolver dnsResolver)
Configuration that defines a DNS resolver.ApacheHttpClient.Builder
expectContinueEnabled(Boolean expectContinueEnabled)
Configure whether the client should send an HTTP expect-continue handshake before each request.ApacheHttpClient.Builder
httpRoutePlanner(org.apache.http.conn.routing.HttpRoutePlanner proxyConfiguration)
Configuration that defines an HTTP route planner that computes the route an HTTP request should take.ApacheHttpClient.Builder
localAddress(InetAddress localAddress)
Configure the local address that the HTTP client should use for communication.ApacheHttpClient.Builder
maxConnections(Integer maxConnections)
The maximum number of connections allowed in the connection pool.ApacheHttpClient.Builder
proxyConfiguration(ProxyConfiguration proxyConfiguration)
Configuration that defines how to communicate via an HTTP proxy.ApacheHttpClient.Builder
socketFactory(org.apache.http.conn.socket.ConnectionSocketFactory socketFactory)
Configuration that defines a custom Socket factory.ApacheHttpClient.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.ApacheHttpClient.Builder
tcpKeepAlive(Boolean keepConnectionAlive)
Configure whether to enable or disable TCP KeepAlive.ApacheHttpClient.Builder
tlsKeyManagersProvider(TlsKeyManagersProvider tlsKeyManagersProvider)
Configure theTlsKeyManagersProvider
that will provide theKeyManager
s to use when constructing the SSL context.ApacheHttpClient.Builder
tlsTrustManagersProvider(TlsTrustManagersProvider tlsTrustManagersProvider)
Configure theTlsTrustManagersProvider
that will provide theTrustManager
s to use when constructing the SSL context.ApacheHttpClient.Builder
useIdleConnectionReaper(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
ApacheHttpClient.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
ApacheHttpClient.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
ApacheHttpClient.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
ApacheHttpClient.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
ApacheHttpClient.Builder proxyConfiguration(ProxyConfiguration proxyConfiguration)
Configuration that defines how to communicate via an HTTP proxy.
-
localAddress
ApacheHttpClient.Builder localAddress(InetAddress localAddress)
Configure the local address that the HTTP client should use for communication.
-
expectContinueEnabled
ApacheHttpClient.Builder expectContinueEnabled(Boolean expectContinueEnabled)
Configure whether the client should send an HTTP expect-continue handshake before each request.
-
connectionTimeToLive
ApacheHttpClient.Builder connectionTimeToLive(Duration connectionTimeToLive)
The maximum amount of time that a connection should be allowed to remain open, regardless of usage frequency.
-
connectionMaxIdleTime
ApacheHttpClient.Builder connectionMaxIdleTime(Duration maxIdleConnectionTimeout)
Configure the maximum amount of time that a connection should be allowed to remain open while idle.
-
useIdleConnectionReaper
ApacheHttpClient.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
ApacheHttpClient.Builder dnsResolver(org.apache.http.conn.DnsResolver dnsResolver)
Configuration that defines a DNS resolver. If no matches are found, the default resolver is used.
-
socketFactory
ApacheHttpClient.Builder socketFactory(org.apache.http.conn.socket.ConnectionSocketFactory socketFactory)
Configuration that defines a custom Socket factory. If set to a null value, a default factory is used.When set to a non-null value, the use of a custom factory implies the configuration options TRUST_ALL_CERTIFICATES, TLS_TRUST_MANAGERS_PROVIDER, and TLS_KEY_MANAGERS_PROVIDER are ignored.
-
httpRoutePlanner
ApacheHttpClient.Builder httpRoutePlanner(org.apache.http.conn.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
ApacheHttpClient.Builder credentialsProvider(org.apache.http.client.CredentialsProvider credentialsProvider)
Configuration that defines a custom credential provider for HTTP requests. May not be used in conjunction withProxyConfiguration.username()
andProxyConfiguration.password()
.
-
tcpKeepAlive
ApacheHttpClient.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
ApacheHttpClient.Builder tlsKeyManagersProvider(TlsKeyManagersProvider tlsKeyManagersProvider)
Configure theTlsKeyManagersProvider
that will provide theKeyManager
s to use when constructing the SSL context.The default used by the client will be
SystemPropertyTlsKeyManagersProvider
. Configure an instance ofNoneTlsKeyManagersProvider
or another implementation ofTlsKeyManagersProvider
to override it.
-
tlsTrustManagersProvider
ApacheHttpClient.Builder tlsTrustManagersProvider(TlsTrustManagersProvider tlsTrustManagersProvider)
Configure theTlsTrustManagersProvider
that will provide theTrustManager
s to use when constructing the SSL context.
-
-