|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.baidubce.http.BceHttpClient
@ThreadSafe public class BceHttpClient
| Field Summary | |
|---|---|
protected BceClientConfiguration |
config
Client configuration options, such as proxy settings, max retries, etc. |
protected org.apache.http.impl.client.CloseableHttpClient |
httpClient
Internal client for sending HTTP requests |
protected Signer |
signer
|
| Constructor Summary | |
|---|---|
BceHttpClient(BceClientConfiguration config,
Signer signer)
Constructs a new BCE client using the specified client configuration options (ex: max retry attempts, proxy settings, etc), and request metric collector. |
|
BceHttpClient(BceClientConfiguration config,
Signer signer,
boolean isHttpAsyncPutEnabled)
Constructs a new BCE Http Client with httpAsyncPutEnabled. |
|
| Method Summary | ||
|---|---|---|
protected org.apache.http.impl.nio.client.CloseableHttpAsyncClient |
createHttpAsyncClient(org.apache.http.nio.conn.NHttpClientConnectionManager connectionManager)
Create asynchronous http client based on connection manager. |
|
protected org.apache.http.client.protocol.HttpClientContext |
createHttpContext(InternalRequest request)
Creates HttpClient Context object based on the internal request. |
|
protected org.apache.http.client.methods.HttpRequestBase |
createHttpRequest(InternalRequest request)
Creates HttpClient method object based on the specified request and populates any parameters, headers, etc. |
|
protected org.apache.http.nio.conn.NHttpClientConnectionManager |
createNHttpClientConnectionManager()
Create connection manager for asynchronous http client. |
|
|
execute(InternalRequest request,
Class<T> responseClass,
HttpResponseHandler[] responseHandlers)
Executes the request and returns the result. |
|
protected void |
finalize()
|
|
protected long |
getDelayBeforeNextRetryInMillis(org.apache.http.client.methods.HttpRequestBase method,
BceClientException exception,
int attempt,
RetryPolicy retryPolicy)
Get delay time before next retry. |
|
void |
shutdown()
Shuts down this HTTP client object, releasing any resources that might be held open. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.http.impl.client.CloseableHttpClient httpClient
protected BceClientConfiguration config
protected Signer signer
| Constructor Detail |
|---|
public BceHttpClient(BceClientConfiguration config,
Signer signer)
config - Configuration options specifying how this client will communicate with BCE (ex: proxy settings,
retry count, etc.).
IllegalArgumentException - If config or signer is null.
public BceHttpClient(BceClientConfiguration config,
Signer signer,
boolean isHttpAsyncPutEnabled)
config - Configuration options specifying how this client will communicate with BCE (ex: proxy settings,
retry count, etc.).isHttpAsyncPutEnabled - whether use Async for PUT method.| Method Detail |
|---|
public <T extends AbstractBceResponse> T execute(InternalRequest request,
Class<T> responseClass,
HttpResponseHandler[] responseHandlers)
request - The BCE request to send to the remote serverresponseClass - A response handler to accept a successful response from the remote serverresponseHandlers - A response handler to accept an unsuccessful response from the remote server
BceClientException - If any errors are encountered on the client while making the
request or handling the response.
BceServiceException - If any errors occurred in BCE while processing the request.public void shutdown()
protected long getDelayBeforeNextRetryInMillis(org.apache.http.client.methods.HttpRequestBase method,
BceClientException exception,
int attempt,
RetryPolicy retryPolicy)
method - The current HTTP method being executed.exception - The client/service exception from the failed request.attempt - The number of times the current request has been attempted.retryPolicy - The retryPolicy being used.
protected org.apache.http.nio.conn.NHttpClientConnectionManager createNHttpClientConnectionManager()
throws org.apache.http.nio.reactor.IOReactorException
org.apache.http.nio.reactor.IOReactorExceptionprotected org.apache.http.impl.nio.client.CloseableHttpAsyncClient createHttpAsyncClient(org.apache.http.nio.conn.NHttpClientConnectionManager connectionManager)
connectionManager - Asynchronous http client connection manager.
protected org.apache.http.client.methods.HttpRequestBase createHttpRequest(InternalRequest request)
request - The request to convert to an HttpClient method object.
protected org.apache.http.client.protocol.HttpClientContext createHttpContext(InternalRequest request)
request - The internal request.
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||