public class ClientConfiguration extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_CONNECTION_REQUEST_TIMEOUT_IN_MILLIS
The default timeout for request new connections form pool.
|
static int |
DEFAULT_CONNECTION_TIMEOUT_IN_MILLIS
The default timeout for creating new connections.
|
static int |
DEFAULT_MAX_CONNECTIONS
The default max connection pool size.
|
static int |
DEFAULT_MAX_CONNECTIONS_PER_ROUTE
The default max connections per route
|
static Protocol |
DEFAULT_PROTOCOL
The default protocol.
|
static Region |
DEFAULT_REGION
The default region.
|
static int |
DEFAULT_SOCKET_TIMEOUT_IN_MILLIS
The default timeout for reading from a connected socket.
|
static String |
DEFAULT_USER_AGENT
The default User-Agent header value when sending requests to the target service.
|
| 构造器和说明 |
|---|
ClientConfiguration()
Constructs a new ClientConfiguration instance with default settings.
|
ClientConfiguration(ClientConfiguration other)
Constructs a new ClientConfiguration instance with the same settings as the specified configuration.
|
| 限定符和类型 | 方法和说明 |
|---|---|
YopCircuitBreakerConfig |
getCircuitBreakerConfig() |
String |
getClientImpl()
Returns the Http Client Impl
|
int |
getConnectionRequestTimeoutInMillis()
Returns the connection request timeout in milliseconds.
|
int |
getConnectionTimeoutInMillis()
Returns the connection timeout in milliseconds.
|
YopCredentials<?> |
getCredentials()
Returns the YOP credentials used by the client to sign HTTP requests.
|
InetAddress |
getLocalAddress()
Returns the optional local address to bind when connecting to YOP services.
|
int |
getMaxConnections()
Returns the maximum number of open HTTP connections.
|
int |
getMaxConnectionsPerRoute() |
int |
getMaxRetryCount() |
Protocol |
getProtocol()
Returns the protocol (HTTP/HTTPS) to use when connecting to YOP services.
|
String |
getProxyDomain()
Returns the optional Windows domain to use when connecting through a Windows NTLM proxy.
|
String |
getProxyHost()
Returns the optional proxy host the client will connect through.
|
String |
getProxyPassword()
Returns the optional password to use when connecting through a proxy.
|
int |
getProxyPort()
Returns the optional proxy port the client will connect through.
|
String |
getProxyScheme()
Returns the optional proxy scheme the client will connect through.
|
String |
getProxyUsername()
Returns the optional user name to use when connecting through a proxy.
|
String |
getProxyWorkstation()
Returns the optional Windows workstation to use when connecting through a Windows NTLM proxy.
|
Region |
getRegion()
Returns the region of service.
|
Set<String> |
getRetryExceptions() |
RetryPolicy |
getRetryPolicy()
Returns the retry policy for failed requests.
|
int |
getSocketBufferSizeInBytes()
Returns the optional size (in bytes) for the low level TCP socket buffer.
|
int |
getSocketTimeoutInMillis()
Returns the socket timeout (SO_TIMEOUT) in milliseconds, which is a maximum period inactivity between two
consecutive data packets.
|
String |
getUserAgent()
Returns the User-Agent header value to use when sending requests to YOP services.
|
boolean |
isProxyPreemptiveAuthenticationEnabled()
Returns whether to enable proxy preemptive authentication.
|
void |
setCircuitBreakerConfig(YopCircuitBreakerConfig circuitBreakerConfig) |
void |
setClientImpl(String clientImpl)
Sets the Http Client Impl
|
void |
setConnectionRequestTimeoutInMillis(int connectionRequestTimeoutInMillis)
Sets the connection request timeout in milliseconds.
|
void |
setConnectionTimeoutInMillis(int connectionTimeoutInMillis)
Sets the connection timeout in milliseconds.
|
void |
setCredentials(YopCredentials<?> credentials)
Sets the YOP credentials used by the client to sign HTTP requests.
|
void |
setLocalAddress(InetAddress localAddress)
Sets the optional local address to bind when connecting to YOP services.
|
void |
setMaxConnections(int maxConnections)
Sets the maximum number of open HTTP connections.
|
void |
setMaxConnectionsPerRoute(int maxConnectionsPerRoute) |
void |
setMaxRetryCount(int maxRetryCount) |
void |
setProtocol(Protocol protocol)
Sets the protocol (HTTP/HTTPS) to use when connecting to YOP services.
|
void |
setProxyDomain(String proxyDomain)
Sets the optional Windows domain to use when connecting through a Windows NTLM proxy.
|
void |
setProxyHost(String proxyHost)
Sets the optional proxy host the client will connect through.
|
void |
setProxyPassword(String proxyPassword)
Sets the optional password to use when connecting through a proxy.
|
void |
setProxyPort(int proxyPort)
Sets the optional proxy port the client will connect through.
|
void |
setProxyPreemptiveAuthenticationEnabled(boolean proxyPreemptiveAuthenticationEnabled)
Sets whether to enable proxy preemptive authentication.
|
void |
setProxyScheme(String proxyScheme)
Sets the optional proxy scheme the client will connect through.
|
void |
setProxyUsername(String proxyUsername)
Sets the optional user name to use when connecting through a proxy.
|
void |
setProxyWorkstation(String proxyWorkstation)
Sets the optional Windows workstation to use when connecting through a Windows NTLM proxy.
|
void |
setRegion(Region region)
Sets the region of service.
|
void |
setRetryExceptions(Set<String> retryExceptions) |
void |
setRetryPolicy(RetryPolicy retryPolicy)
Sets the retry policy for failed requests.
|
void |
setSocketBufferSizeInBytes(int socketBufferSizeInBytes)
Sets the optional size (in bytes) for the low level TCP socket buffer.
|
void |
setSocketTimeoutInMillis(int socketTimeoutInMillis)
Sets the socket timeout (SO_TIMEOUT) in milliseconds, which is a maximum period inactivity between two
consecutive data packets.
|
void |
setUserAgent(String userAgent)
Sets the User-Agent header value to use when sending requests to YOP services.
|
String |
toString() |
ClientConfiguration |
withCircuitBreakerConfig(YopCircuitBreakerConfig circuitBreakerConfig) |
ClientConfiguration |
withClientImpl(String clientImpl)
Sets the Http Client Impl.
|
ClientConfiguration |
withConnectionRequestTimeoutInMillis(int connectionRequestTimeoutInMillis)
Sets the connection request timeout in milliseconds, and returns the updated configuration instance.
|
ClientConfiguration |
withConnectionTimeoutInMillis(int connectionTimeoutInMillis)
Sets the connection timeout in milliseconds, and returns the updated configuration instance.
|
ClientConfiguration |
withCredentials(YopCredentials<?> credentials)
Sets the YOP credentials used by the client to sign HTTP requests, and returns the updated configuration
instance.
|
ClientConfiguration |
withLocalAddress(InetAddress localAddress)
Sets the optional local address to bind when connecting to YOP services, and returns the updated configuration
instance.
|
ClientConfiguration |
withMaxConnections(int maxConnections)
Sets the maximum number of open HTTP connections, and returns the updated configuration instance.
|
ClientConfiguration |
withMaxConnectionsPerRoute(int maxConnections)
Sets the maximum number of per route, and returns the updated configuration instance.
|
ClientConfiguration |
withMaxRetryCount(int maxRetryCount) |
ClientConfiguration |
withProtocol(Protocol protocol)
Sets the protocol (HTTP/HTTPS) to use when connecting to YOP services, and returns the updated configuration
instance.
|
ClientConfiguration |
withProxyDomain(String proxyDomain)
Sets the optional Windows domain to use when connecting through a Windows NTLM proxy, and returns the updated
configuration instance.
|
ClientConfiguration |
withProxyHost(String proxyHost)
Sets the optional proxy host the client will connect through, and returns the updated configuration instance.
|
ClientConfiguration |
withProxyPassword(String proxyPassword)
Sets the optional password to use when connecting through a proxy, and returns the updated configuration
instance.
|
ClientConfiguration |
withProxyPort(int proxyPort)
Sets the optional proxy port the client will connect through, and returns the updated configuration instance.
|
ClientConfiguration |
withProxyPreemptiveAuthenticationEnabled(boolean proxyPreemptiveAuthenticationEnabled)
Sets whether to enable proxy preemptive authentication, and returns the updated configuration instance.
|
ClientConfiguration |
withProxyScheme(String proxyScheme)
Sets the optional proxy scheme the client will connect through, and returns the updated configuration instance.
|
ClientConfiguration |
withProxyUsername(String proxyUsername)
Sets the optional user name to use when connecting through a proxy, and returns the updated configuration
instance.
|
ClientConfiguration |
withProxyWorkstation(String proxyWorkstation)
Sets the optional Windows workstation to use when connecting through a Windows NTLM proxy, and returns the
updated configuration instance.
|
ClientConfiguration |
withRegion(Region region)
Sets the region of service, and returns the updated configuration instance.
|
ClientConfiguration |
withRetryExceptions(Set<String> retryExceptions) |
ClientConfiguration |
withRetryPolicy(RetryPolicy retryPolicy)
Sets the retry policy for failed requests, and returns the updated configuration instance.
|
ClientConfiguration |
withSocketBufferSizeInBytes(int socketBufferSizeInBytes)
Sets the optional size (in bytes) for the low level TCP socket buffer, and returns the updated configuration
instance.
|
ClientConfiguration |
withSocketTimeoutInMillis(int socketTimeoutInMillis)
Sets the socket timeout (SO_TIMEOUT) in milliseconds, which is a maximum period inactivity between two
consecutive data packets, and returns the updated configuration instance.
|
ClientConfiguration |
withUserAgent(String userAgent)
Sets the User-Agent header value to use when sending requests to YOP services, and returns the updated
configuration instance.
|
public static final int DEFAULT_CONNECTION_TIMEOUT_IN_MILLIS
public static final int DEFAULT_CONNECTION_REQUEST_TIMEOUT_IN_MILLIS
public static final int DEFAULT_SOCKET_TIMEOUT_IN_MILLIS
public static final int DEFAULT_MAX_CONNECTIONS
public static final int DEFAULT_MAX_CONNECTIONS_PER_ROUTE
public static final String DEFAULT_USER_AGENT
public static Region DEFAULT_REGION
public static Protocol DEFAULT_PROTOCOL
public ClientConfiguration()
public ClientConfiguration(ClientConfiguration other)
other - the configuration to copy settings from.public Protocol getProtocol()
public void setProtocol(Protocol protocol)
protocol - the protocol (HTTP/HTTPS) to use when connecting to YOP services.public ClientConfiguration withProtocol(Protocol protocol)
protocol - the protocol (HTTP/HTTPS) to use when connecting to YOP services.public int getMaxConnections()
public void setMaxConnections(int maxConnections)
maxConnections - the maximum number of open HTTP connections.IllegalArgumentException - if maxConnections is negative.public int getMaxConnectionsPerRoute()
public void setMaxConnectionsPerRoute(int maxConnectionsPerRoute)
public ClientConfiguration withMaxConnections(int maxConnections)
maxConnections - the maximum number of open HTTP connections.IllegalArgumentException - if maxConnections is negative.public ClientConfiguration withMaxConnectionsPerRoute(int maxConnections)
maxConnections - the maximum number of per route.IllegalArgumentException - if maxConnections is negative.public String getUserAgent()
public void setUserAgent(String userAgent)
If the specified value is null, DEFAULT_USER_AGENT is used. If the specified value does not end with DEFAULT_USER_AGENT, DEFAULT_USER_AGENT is appended.
userAgent - the User-Agent header value to use when sending requests to YOP services.public ClientConfiguration withUserAgent(String userAgent)
If the specified value is null, DEFAULT_USER_AGENT is used. If the specified value does not end with DEFAULT_USER_AGENT, DEFAULT_USER_AGENT is appended.
userAgent - the User-Agent header value to use when sending requests to YOP services.public InetAddress getLocalAddress()
public void setLocalAddress(InetAddress localAddress)
localAddress - the optional local address to bind when connecting to YOP services.public ClientConfiguration withLocalAddress(InetAddress localAddress)
localAddress - the optional local address to bind when connecting to YOP services.public String getProxyHost()
public void setProxyHost(String proxyHost)
The client will connect through the proxy only if the host is not null and the port is positive.
proxyHost - the optional proxy host the client will connect through.public ClientConfiguration withProxyHost(String proxyHost)
The client will connect through the proxy only if the host is not null and the port is positive.
proxyHost - the optional proxy host the client will connect through.public int getProxyPort()
public void setProxyPort(int proxyPort)
The client will connect through the proxy only if the host is not null and the port is positive.
proxyPort - the optional proxy port the client will connect through.public ClientConfiguration withProxyPort(int proxyPort)
The client will connect through the proxy only if the host is not null and the port is positive.
proxyPort - the optional proxy port the client will connect through.public String getProxyScheme()
public void setProxyScheme(String proxyScheme)
The client will connect through the proxy only if the host is not null and the port is positive.
proxyScheme - the optional proxy scheme the client will connect through.public ClientConfiguration withProxyScheme(String proxyScheme)
The client will connect through the proxy only if the host is not null and the port is positive.
proxyScheme - the optional proxy port the client will connect through.public String getProxyUsername()
public void setProxyUsername(String proxyUsername)
proxyUsername - the optional user name to use when connecting through a proxy.public ClientConfiguration withProxyUsername(String proxyUsername)
proxyUsername - the optional user name to use when connecting through a proxy.public String getProxyPassword()
public void setProxyPassword(String proxyPassword)
proxyPassword - the optional password to use when connecting through a proxy.public ClientConfiguration withProxyPassword(String proxyPassword)
proxyPassword - the optional password to use when connecting through a proxy.public String getProxyDomain()
public void setProxyDomain(String proxyDomain)
proxyDomain - the optional Windows domain to use when connecting through a Windows NTLM proxy.public ClientConfiguration withProxyDomain(String proxyDomain)
proxyDomain - the optional Windows domain to use when connecting through a Windows NTLM proxy.public String getProxyWorkstation()
public void setProxyWorkstation(String proxyWorkstation)
proxyWorkstation - the optional Windows workstation to use when connecting through a Windows NTLM proxy.public ClientConfiguration withProxyWorkstation(String proxyWorkstation)
proxyWorkstation - the optional Windows workstation to use when connecting through a Windows NTLM proxy.public boolean isProxyPreemptiveAuthenticationEnabled()
public void setProxyPreemptiveAuthenticationEnabled(boolean proxyPreemptiveAuthenticationEnabled)
proxyPreemptiveAuthenticationEnabled - whether to enable proxy preemptive authentication.public ClientConfiguration withProxyPreemptiveAuthenticationEnabled(boolean proxyPreemptiveAuthenticationEnabled)
proxyPreemptiveAuthenticationEnabled - whether to enable proxy preemptive authentication.public RetryPolicy getRetryPolicy()
public void setRetryPolicy(RetryPolicy retryPolicy)
retryPolicy - the retry policy for failed requests.public ClientConfiguration withRetryPolicy(RetryPolicy retryPolicy)
retryPolicy - the retry policy for failed requests.public int getSocketTimeoutInMillis()
public void setSocketTimeoutInMillis(int socketTimeoutInMillis)
socketTimeoutInMillis - the socket timeout (SO_TIMEOUT) in milliseconds.IllegalArgumentException - if socketTimeoutInMillis is negative.public ClientConfiguration withSocketTimeoutInMillis(int socketTimeoutInMillis)
socketTimeoutInMillis - the socket timeout (SO_TIMEOUT) in milliseconds.IllegalArgumentException - if socketTimeoutInMillis is negative.public int getConnectionTimeoutInMillis()
public void setConnectionTimeoutInMillis(int connectionTimeoutInMillis)
connectionTimeoutInMillis - the connection timeout in milliseconds.IllegalArgumentException - if connectionTimeoutInMillis is negative.public ClientConfiguration withConnectionTimeoutInMillis(int connectionTimeoutInMillis)
connectionTimeoutInMillis - the connection timeout in milliseconds.IllegalArgumentException - if connectionTimeoutInMillis is negative.public int getConnectionRequestTimeoutInMillis()
public void setConnectionRequestTimeoutInMillis(int connectionRequestTimeoutInMillis)
connectionRequestTimeoutInMillis - the connection request timeout in milliseconds.IllegalArgumentException - if connectionRequestTimeoutInMillis is negative.public ClientConfiguration withConnectionRequestTimeoutInMillis(int connectionRequestTimeoutInMillis)
connectionRequestTimeoutInMillis - the connection request timeout in milliseconds.IllegalArgumentException - if connectionRequestTimeoutInMillis is negative.public int getSocketBufferSizeInBytes()
public void setSocketBufferSizeInBytes(int socketBufferSizeInBytes)
socketBufferSizeInBytes - the optional size (in bytes) for the low level TCP socket buffer.public ClientConfiguration withSocketBufferSizeInBytes(int socketBufferSizeInBytes)
socketBufferSizeInBytes - the optional size (in bytes) for the low level TCP socket buffer.public Region getRegion()
public void setRegion(Region region)
If the specified region is null, sets to DEFAULT_REGION.
region - the region of service.public ClientConfiguration withRegion(Region region)
If the specified region is null, sets to DEFAULT_REGION.
region - the region of service.public YopCredentials<?> getCredentials()
public void setCredentials(YopCredentials<?> credentials)
credentials - the YOP credentials used by the client to sign HTTP requests.NullPointerException - if credentials is null.public ClientConfiguration withCredentials(YopCredentials<?> credentials)
credentials - the YOP credentials used by the client to sign HTTP requests.NullPointerException - if credentials is null.public String getClientImpl()
public void setClientImpl(String clientImpl)
clientImpl - the Http Client ImplNullPointerException - if clientImpl is null.public ClientConfiguration withClientImpl(String clientImpl)
clientImpl - the Http Client Impl.NullPointerException - if clientImpl is null.public int getMaxRetryCount()
public void setMaxRetryCount(int maxRetryCount)
public ClientConfiguration withMaxRetryCount(int maxRetryCount)
public ClientConfiguration withRetryExceptions(Set<String> retryExceptions)
public YopCircuitBreakerConfig getCircuitBreakerConfig()
public void setCircuitBreakerConfig(YopCircuitBreakerConfig circuitBreakerConfig)
public ClientConfiguration withCircuitBreakerConfig(YopCircuitBreakerConfig circuitBreakerConfig)
Copyright © 2024. All rights reserved.