public final class ApacheHttpTransport extends HttpTransport
Implementation is thread-safe, as long as any parameter modification to the
Apache HTTP Client is only done at initialization time. For maximum
efficiency, applications should use a single globally-shared instance of the HTTP transport.
Default settings are specified in newDefaultHttpClient(). Use the
ApacheHttpTransport(HttpClient) constructor to override the Apache HTTP Client used.
Please read the Apache HTTP
Client connection management tutorial for more complex configuration options.
| Constructor and Description |
|---|
ApacheHttpTransport()
Constructor that uses
newDefaultHttpClient() for the Apache HTTP client. |
ApacheHttpTransport(org.apache.http.client.HttpClient httpClient)
Constructor that allows an alternative Apache HTTP client to be used.
|
| Modifier and Type | Method and Description |
|---|---|
protected com.google.api.client.http.apache.ApacheHttpRequest |
buildRequest(String method,
String url) |
org.apache.http.client.HttpClient |
getHttpClient()
Returns the Apache HTTP client.
|
static org.apache.http.client.HttpClient |
newDefaultHttpClient()
Creates a new instance of the Apache HTTP client that is used by the
ApacheHttpTransport() constructor. |
void |
shutdown()
Shuts down the connection manager and releases allocated resources.
|
boolean |
supportsMethod(String method) |
createRequestFactory, createRequestFactorypublic ApacheHttpTransport()
newDefaultHttpClient() for the Apache HTTP client.public ApacheHttpTransport(org.apache.http.client.HttpClient httpClient)
Note that in the previous version, we tried overrode several settings, however, we are no longer able to do so.
If you choose to provide your own Apache HttpClient implementation, be sure that
httpClient - Apache HTTP client to usepublic static org.apache.http.client.HttpClient newDefaultHttpClient()
ApacheHttpTransport() constructor.
Settings:
PoolingHttpClientConnectionManager.SocketConfig.SystemDefaultRoutePlanner with
ProxySelector.getDefault(), which uses the proxy settings from system
properties.public boolean supportsMethod(String method)
supportsMethod in class HttpTransportprotected com.google.api.client.http.apache.ApacheHttpRequest buildRequest(String method, String url)
buildRequest in class HttpTransportpublic void shutdown()
throws IOException
shutdown in class HttpTransportIOExceptionpublic org.apache.http.client.HttpClient getHttpClient()
Copyright © 2011–2019 Google. All rights reserved.