|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.baidubce.BceClientConfiguration
@NotThreadSafe public class BceClientConfiguration
Basic client configurations for BCE clients.
Field Summary | |
---|---|
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 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. |
Constructor Summary | |
---|---|
BceClientConfiguration()
Constructs a new BceClientConfiguration instance with default settings. |
|
BceClientConfiguration(BceClientConfiguration other)
Constructs a new BceClientConfiguration instance with the same settings as the specified configuration. |
|
BceClientConfiguration(BceClientConfiguration other,
String endpoint)
Constructs a new BceClientConfiguration instance with the same settings as the specified configuration. |
Method Summary | |
---|---|
int |
getConnectionTimeoutInMillis()
Returns the connection timeout in milliseconds. |
BceCredentials |
getCredentials()
Returns the BCE credentials used by the client to sign HTTP requests. |
String |
getEndpoint()
Returns the service endpoint URL to which the client will connect. |
InetAddress |
getLocalAddress()
Returns the optional local address to bind when connecting to BCE services. |
int |
getMaxConnections()
Returns the maximum number of open HTTP connections. |
Protocol |
getProtocol()
Returns the protocol (HTTP/HTTPS) to use when connecting to BCE 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 |
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. |
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 BCE services. |
boolean |
isProxyPreemptiveAuthenticationEnabled()
Returns whether to enable proxy preemptive authentication. |
void |
setConnectionTimeoutInMillis(int connectionTimeoutInMillis)
Sets the connection timeout in milliseconds. |
void |
setCredentials(BceCredentials credentials)
Sets the BCE credentials used by the client to sign HTTP requests. |
void |
setEndpoint(String endpoint)
Sets the service endpoint URL to which the client will connect. |
void |
setLocalAddress(InetAddress localAddress)
Sets the optional local address to bind when connecting to BCE services. |
void |
setMaxConnections(int maxConnections)
Sets the maximum number of open HTTP connections. |
void |
setProtocol(Protocol protocol)
Sets the protocol (HTTP/HTTPS) to use when connecting to BCE 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 |
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 |
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 BCE services. |
String |
toString()
|
BceClientConfiguration |
withConnectionTimeoutInMillis(int connectionTimeoutInMillis)
Sets the connection timeout in milliseconds, and returns the updated configuration instance. |
BceClientConfiguration |
withCredentials(BceCredentials credentials)
Sets the BCE credentials used by the client to sign HTTP requests, and returns the updated configuration instance. |
BceClientConfiguration |
withEndpoint(String endpoint)
Sets the service endpoint URL to which the client will connect, and returns the updated configuration instance. |
BceClientConfiguration |
withLocalAddress(InetAddress localAddress)
Sets the optional local address to bind when connecting to BCE services, and returns the updated configuration instance. |
BceClientConfiguration |
withMaxConnections(int maxConnections)
Sets the maximum number of open HTTP connections, and returns the updated configuration instance. |
BceClientConfiguration |
withProtocol(Protocol protocol)
Sets the protocol (HTTP/HTTPS) to use when connecting to BCE services, and returns the updated configuration instance. |
BceClientConfiguration |
withProxyDomain(String proxyDomain)
Sets the optional Windows domain to use when connecting through a Windows NTLM proxy, and returns the updated configuration instance. |
BceClientConfiguration |
withProxyHost(String proxyHost)
Sets the optional proxy host the client will connect through, and returns the updated configuration instance. |
BceClientConfiguration |
withProxyPassword(String proxyPassword)
Sets the optional password to use when connecting through a proxy, and returns the updated configuration instance. |
BceClientConfiguration |
withProxyPort(int proxyPort)
Sets the optional proxy port the client will connect through, and returns the updated configuration instance. |
BceClientConfiguration |
withProxyPreemptiveAuthenticationEnabled(boolean proxyPreemptiveAuthenticationEnabled)
Sets whether to enable proxy preemptive authentication, and returns the updated configuration instance. |
BceClientConfiguration |
withProxyUsername(String proxyUsername)
Sets the optional user name to use when connecting through a proxy, and returns the updated configuration instance. |
BceClientConfiguration |
withProxyWorkstation(String proxyWorkstation)
Sets the optional Windows workstation to use when connecting through a Windows NTLM proxy, and returns the updated configuration instance. |
BceClientConfiguration |
withRegion(Region region)
Sets the region of service, and returns the updated configuration instance. |
BceClientConfiguration |
withRetryPolicy(RetryPolicy retryPolicy)
Sets the retry policy for failed requests, and returns the updated configuration instance. |
BceClientConfiguration |
withSocketBufferSizeInBytes(int socketBufferSizeInBytes)
Sets the optional size (in bytes) for the low level TCP socket buffer, and returns the updated configuration instance. |
BceClientConfiguration |
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. |
BceClientConfiguration |
withUserAgent(String userAgent)
Sets the User-Agent header value to use when sending requests to BCE services, and returns the updated configuration instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_CONNECTION_TIMEOUT_IN_MILLIS
public static final int DEFAULT_SOCKET_TIMEOUT_IN_MILLIS
public static final int DEFAULT_MAX_CONNECTIONS
public static final String DEFAULT_USER_AGENT
public static Region DEFAULT_REGION
public static Protocol DEFAULT_PROTOCOL
Constructor Detail |
---|
public BceClientConfiguration()
public BceClientConfiguration(BceClientConfiguration other)
other
- the configuration to copy settings from.public BceClientConfiguration(BceClientConfiguration other, String endpoint)
other
- the configuration to copy settings from.endpoint
- the endpointMethod Detail |
---|
public Protocol getProtocol()
public void setProtocol(Protocol protocol)
protocol
- the protocol (HTTP/HTTPS) to use when connecting to BCE services.public BceClientConfiguration withProtocol(Protocol protocol)
protocol
- the protocol (HTTP/HTTPS) to use when connecting to BCE services.
public int getMaxConnections()
public void setMaxConnections(int maxConnections)
maxConnections
- the maximum number of open HTTP connections.
IllegalArgumentException
- if maxConnections is negative.public BceClientConfiguration withMaxConnections(int maxConnections)
maxConnections
- the maximum number of open HTTP connections.
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 BCE services.public BceClientConfiguration 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 BCE services.
public InetAddress getLocalAddress()
public void setLocalAddress(InetAddress localAddress)
localAddress
- the optional local address to bind when connecting to BCE services.public BceClientConfiguration withLocalAddress(InetAddress localAddress)
localAddress
- the optional local address to bind when connecting to BCE 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 BceClientConfiguration 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 BceClientConfiguration 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 getProxyUsername()
public void setProxyUsername(String proxyUsername)
proxyUsername
- the optional user name to use when connecting through a proxy.public BceClientConfiguration 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 BceClientConfiguration 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 BceClientConfiguration 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 BceClientConfiguration 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 BceClientConfiguration 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 BceClientConfiguration 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 BceClientConfiguration 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 BceClientConfiguration withConnectionTimeoutInMillis(int connectionTimeoutInMillis)
connectionTimeoutInMillis
- the connection timeout in milliseconds.
IllegalArgumentException
- if connectionTimeoutInMillis is negative.public int getSocketBufferSizeInBytes()
public void setSocketBufferSizeInBytes(int socketBufferSizeInBytes)
socketBufferSizeInBytes
- the optional size (in bytes) for the low level TCP socket buffer.public BceClientConfiguration withSocketBufferSizeInBytes(int socketBufferSizeInBytes)
socketBufferSizeInBytes
- the optional size (in bytes) for the low level TCP socket buffer.
public String getEndpoint()
public void setEndpoint(String endpoint)
endpoint
- the service endpoint URL to which the client will connect.
IllegalArgumentException
- if endpoint is not a valid URL.
NullPointerException
- if endpoint is null.public BceClientConfiguration withEndpoint(String endpoint)
endpoint
- the service endpoint URL to which the client will connect.
IllegalArgumentException
- if endpoint is not a valid URL.
NullPointerException
- if endpoint is null.public Region getRegion()
public void setRegion(Region region)
If the specified region is null, sets to DEFAULT_REGION.
region
- the region of service.public BceClientConfiguration withRegion(Region region)
If the specified region is null, sets to DEFAULT_REGION.
region
- the region of service.
public BceCredentials getCredentials()
public void setCredentials(BceCredentials credentials)
credentials
- the BCE credentials used by the client to sign HTTP requests.
NullPointerException
- if credentials is null.public BceClientConfiguration withCredentials(BceCredentials credentials)
credentials
- the BCE credentials used by the client to sign HTTP requests.
NullPointerException
- if credentials is null.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |