public class HttpSettings extends Object
This class allows configuration of various HTTP connection parameters including timeouts, connection pooling, and proxy settings. It follows the builder pattern to create immutable instances with default values that can be customized as needed.
Example usage:
HttpSettings httpSettings = HttpSettings.newBuilder()
.withConnectTimeout(Duration.ofSeconds(30))
.withReadTimeout(Duration.ofSeconds(300))
.withMaxIdleConnections(10)
.withKeepAliveDuration(Duration.ofMinutes(10))
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpSettings.HttpSettingsBuilder |
| Modifier and Type | Method and Description |
|---|---|
Duration |
getConnectTimeout()
Gets the connection timeout duration.
|
Duration |
getKeepAliveDuration()
Gets the keep-alive duration for idle connections.
|
int |
getMaxIdleConnections()
Gets the maximum number of idle connections to keep in the connection pool.
|
ProxyConfig |
getProxyConfig()
Gets the proxy configuration, if any.
|
Duration |
getReadTimeout()
Gets the read timeout duration.
|
static HttpSettings.HttpSettingsBuilder |
newBuilder() |
public Duration getConnectTimeout()
The connection timeout is the maximum time to wait when establishing a connection to the server before giving up.
public Duration getReadTimeout()
The read timeout is the maximum time to wait for data to be available for reading from an established connection before giving up.
public int getMaxIdleConnections()
public Duration getKeepAliveDuration()
Connections that have been idle for longer than this duration will be closed.
public ProxyConfig getProxyConfig()
public static HttpSettings.HttpSettingsBuilder newBuilder()
Copyright © 2026 Alibaba Cloud Computing. All rights reserved.