public class ClientConfiguration extends Object
构造器和说明 |
---|
ClientConfiguration() |
限定符和类型 | 方法和说明 |
---|---|
void |
addDefaultHeader(String key,
String value)
Add a default header into the default header list.
|
List<String> |
getCnameExcludeList()
Gets the immutable excluded CName list----any domain ends with an item in
this list will not do Cname resolution.
|
int |
getConnectionRequestTimeout()
Gets the timeout in millisecond for retrieving an available connection
from the connection manager. 0 means infinite and -1 means not defined.
|
int |
getConnectionTimeout()
Gets the socket connection timeout in millisecond.
|
long |
getConnectionTTL()
Gets the connection TTL (time to live).
|
Map<String,String> |
getDefaultHeaders()
Gets the default http headers.
|
long |
getIdleConnectionTime()
Gets the connection's max idle time.
|
int |
getMaxConnections()
Gets the max connection count.
|
int |
getMaxErrorRetry()
Gets the max retry count upon a retryable error.
|
Protocol |
getProtocol()
Gets the OSS's protocol (HTTP or HTTPS).
|
String |
getProxyDomain()
Gets the proxy server's domain, which could do the NTLM authentiation
(optional).
|
String |
getProxyHost()
Gets proxy host.
|
String |
getProxyPassword()
Gets the proxy user password.
|
int |
getProxyPort()
Gets the proxy host's port.
|
String |
getProxyUsername()
Gets the proxy user name.
|
String |
getProxyWorkstation()
Gets the proxy host's NTLM authentication server.
|
int |
getRequestTimeout()
Gets the timeout value in millisecond.
|
SignVersion |
getSignatureVersion()
Gets signature version
|
List<RequestSigner> |
getSignerHandlers()
Gets signer handlers
|
long |
getSlowRequestsThreshold()
Sets the slow request's latency threshold.
|
int |
getSocketTimeout()
Gets the socket timeout in millisecond. 0 means infinite timeout, not
recommended.
|
long |
getTickOffset()
Gets the difference between customized epoch time and local time, in millisecond.
|
String |
getUserAgent()
Gets the user agent string.
|
int |
getValidateAfterInactivity()
The connection idle time threshold in millisecond that triggers the
validation.
|
boolean |
isCrcCheckEnabled()
Gets the flag of enabling CRC checksum on upload and download.
|
boolean |
isRequestTimeoutEnabled()
Gets the flag of enabling request timeout.
|
boolean |
isSLDEnabled()
Gets the flag of using SLD (Second Level Domain) style to access the
endpoint.
|
boolean |
isSupportCname()
Gets the flag if supporting Cname in the endpoint.
|
boolean |
isUseReaper()
Gets the flag of using
IdleConnectionReaper to manage expired
connection. |
void |
setCnameExcludeList(List<String> cnameExcludeList)
Sets the immutable excluded CName list----any domain ends with an item in
this list will not do Cname resolution.
|
void |
setConnectionRequestTimeout(int connectionRequestTimeout)
Sets the timeout in millisecond for retrieving an available connection
from the connection manager.
|
void |
setConnectionTimeout(int connectionTimeout)
Sets the socket connection timeout in millisecond.
|
void |
setConnectionTTL(long connectionTTL)
Sets the connection TTL (time to live).
|
void |
setCrcCheckEnabled(boolean crcCheckEnabled)
Sets the flag of enabling CRC checksum on upload and download.
|
void |
setDefaultHeaders(Map<String,String> defaultHeaders)
Sets the default http headers.
|
void |
setIdleConnectionTime(long idleConnectionTime)
Sets the connection's max idle time.
|
void |
setMaxConnections(int maxConnections)
Sets the max connection count.
|
void |
setMaxErrorRetry(int maxErrorRetry)
Sets the max retry count upon a retryable error.
|
void |
setProtocol(Protocol protocol)
Sets the OSS's protocol (HTTP or HTTPS).
|
void |
setProxyDomain(String proxyDomain)
Sets the proxy server's domain, which could do the NTLM authentication
(optional).
|
void |
setProxyHost(String proxyHost)
Sets the proxy host.
|
void |
setProxyPassword(String proxyPassword)
Sets the proxy user password.
|
void |
setProxyPort(int proxyPort)
Sets proxy port.
|
void |
setProxyUsername(String proxyUsername)
Sets the proxy user name.
|
void |
setProxyWorkstation(String proxyWorkstation)
Sets the proxy host's NTLM authentication server(optional, if the proxy
server does not require NTLM authentication, then it's not needed).
|
void |
setRequestTimeout(int requestTimeout)
Sets the timeout value in millisecond.
|
void |
setRequestTimeoutEnabled(boolean requestTimeoutEnabled)
Gets the flag of enabling request timeout.
|
void |
setSignatureVersion(SignVersion signatureVersion)
Sets signature version for all request.
|
void |
setSignerHandlers(List<RequestSigner> signerHandlers)
Sets signer handlers using for authentication of the proxy server.
|
ClientConfiguration |
setSLDEnabled(boolean enabled)
Sets the flag of using SLD (Second Level Domain) style to access the
endpoint.
|
void |
setSlowRequestsThreshold(long slowRequestsThreshold)
Gets the slow request's latency threshold.
|
void |
setSocketTimeout(int socketTimeout)
Sets the socket timeout in millisecond. 0 means infinite timeout, not
recommended.
|
ClientConfiguration |
setSupportCname(boolean supportCname)
Sets the flag if supporting Cname in the endpoint.
|
void |
setTickOffset(long epochTicks)
Sets the custom base time.
|
void |
setUserAgent(String userAgent)
Sets the user agent string.
|
void |
setUseReaper(boolean useReaper)
Sets the flag of using
IdleConnectionReaper to manage expired
connection. |
public static final String DEFAULT_USER_AGENT
public static final int DEFAULT_MAX_RETRIES
public static final int DEFAULT_CONNECTION_REQUEST_TIMEOUT
public static final int DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_SOCKET_TIMEOUT
public static final int DEFAULT_MAX_CONNECTIONS
public static final long DEFAULT_CONNECTION_TTL
public static final long DEFAULT_IDLE_CONNECTION_TIME
public static final int DEFAULT_VALIDATE_AFTER_INACTIVITY
public static final int DEFAULT_THREAD_POOL_WAIT_TIME
public static final int DEFAULT_REQUEST_TIMEOUT
public static final long DEFAULT_SLOW_REQUESTS_THRESHOLD
public static final boolean DEFAULT_USE_REAPER
public static final SignVersion DEFAULT_SIGNATURE_VERSION
protected String userAgent
protected int maxErrorRetry
protected int connectionRequestTimeout
protected int connectionTimeout
protected int socketTimeout
protected int maxConnections
protected long connectionTTL
protected boolean useReaper
protected long idleConnectionTime
protected Protocol protocol
protected String proxyHost
protected int proxyPort
protected String proxyUsername
protected String proxyPassword
protected String proxyDomain
protected String proxyWorkstation
protected boolean supportCname
protected Lock rlock
protected boolean sldEnabled
protected int requestTimeout
protected boolean requestTimeoutEnabled
protected long slowRequestsThreshold
protected boolean crcCheckEnabled
protected List<RequestSigner> signerHandlers
protected SignVersion signatureVersion
protected long tickOffset
public String getUserAgent()
public void setUserAgent(String userAgent)
userAgent
- The user agent string.public String getProxyHost()
public void setProxyHost(String proxyHost)
proxyHost
- The proxy host in string.public int getProxyPort()
public void setProxyPort(int proxyPort) throws ClientException
proxyPort
- The proxy port.ClientException
public String getProxyUsername()
public void setProxyUsername(String proxyUsername)
proxyUsername
- The user name.public String getProxyPassword()
public void setProxyPassword(String proxyPassword)
proxyPassword
- The proxy user password.public String getProxyDomain()
public void setProxyDomain(String proxyDomain)
proxyDomain
- The proxy domain name.public String getProxyWorkstation()
public void setProxyWorkstation(String proxyWorkstation)
proxyWorkstation
- The proxy host's NTLM authentication server name.public int getMaxConnections()
public void setMaxConnections(int maxConnections)
maxConnections
- The max connection count.public int getSocketTimeout()
public void setSocketTimeout(int socketTimeout)
socketTimeout
- The socket timeout in millisecond.public int getConnectionTimeout()
public void setConnectionTimeout(int connectionTimeout)
connectionTimeout
- The socket connection timeout in millisecond.public int getConnectionRequestTimeout()
public void setConnectionRequestTimeout(int connectionRequestTimeout)
connectionRequestTimeout
- The timeout in millisecond.public int getMaxErrorRetry()
public void setMaxErrorRetry(int maxErrorRetry)
maxErrorRetry
- The max retry count.public long getConnectionTTL()
public void setConnectionTTL(long connectionTTL)
connectionTTL
- The connection TTL in millisecond.public boolean isUseReaper()
IdleConnectionReaper
to manage expired
connection.public void setUseReaper(boolean useReaper)
IdleConnectionReaper
to manage expired
connection.public long getIdleConnectionTime()
public void setIdleConnectionTime(long idleConnectionTime)
idleConnectionTime
- The connection's max idle time in millisecond.public Protocol getProtocol()
public void setProtocol(Protocol protocol)
public List<String> getCnameExcludeList()
public void setCnameExcludeList(List<String> cnameExcludeList)
cnameExcludeList
- The excluded CName list, immutable.public boolean isSupportCname()
public ClientConfiguration setSupportCname(boolean supportCname)
If this value is set true, when building a canonical url, the host would be checked against the Cname excluded list. If that host is found in the list, then it's treated as non-CName and accessed as TLD (third level domain). If the host is found, then it's thought as CName. If this value is set false, then always uses TLD to access the endpoint.
supportCname
- The flag if supporting CName.public boolean isSLDEnabled()
public ClientConfiguration setSLDEnabled(boolean enabled)
enabled
- True if it's enabled; False if it's disabled.public int getValidateAfterInactivity()
public boolean isRequestTimeoutEnabled()
public void setRequestTimeoutEnabled(boolean requestTimeoutEnabled)
requestTimeoutEnabled
- true to enable; false to disable.public void setRequestTimeout(int requestTimeout)
public int getRequestTimeout()
public long getSlowRequestsThreshold()
public void setSlowRequestsThreshold(long slowRequestsThreshold)
public Map<String,String> getDefaultHeaders()
public void setDefaultHeaders(Map<String,String> defaultHeaders)
defaultHeaders
- Default http headers.public void addDefaultHeader(String key, String value)
key
- The default header name.value
- The default header value.public boolean isCrcCheckEnabled()
public void setCrcCheckEnabled(boolean crcCheckEnabled)
crcCheckEnabled
- True to enable CRC; False to disable CRC.public List<RequestSigner> getSignerHandlers()
public void setSignerHandlers(List<RequestSigner> signerHandlers)
signerHandlers
- public SignVersion getSignatureVersion()
public void setSignatureVersion(SignVersion signatureVersion)
signatureVersion
- public long getTickOffset()
public void setTickOffset(long epochTicks)
epochTicks
- Custom Epoch ticks (in millisecond).Copyright © 2019. All Rights Reserved.