|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.api.client.http.HttpTransport
public abstract class HttpTransport
Thread-safe abstract HTTP transport.
Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency, applications should use a single globally-shared instance of the HTTP transport.
The recommended concrete implementation HTTP transport library to use depends on what environment you are running in:
com.google.api.client.appengine.UrlFetchTransport
.
com.google.api.client.apache.ApacheHttpTransport
doesn't work on App Engine because
the Apache HTTP Client opens its own sockets (though in theory there are ways to hack it to work
on App Engine that might work).com.google.api.client.javanet.NetHttpTransport
is discouraged due to a bug in the App
Engine SDK itself in how it parses HTTP headers in the response.com.google.api.client.javanet.NetHttpTransport
. Their Apache HTTP Client implementation is not
as well maintained.com.google.api.client.apache.ApacheHttpTransport
. com.google.api.client.javanet.NetHttpTransport
is not recommended due to some bugs in the
Android SDK implementation of HttpURLConnection.com.google.api.client.javanet.NetHttpTransport
is based on the HttpURLConnection
built into the Java SDK, so it is normally the preferred choice.com.google.api.client.apache.ApacheHttpTransport
is a good choice for users of the
Apache HTTP Client, especially if you need some of the configuration options available in that
library.
Constructor Summary | |
---|---|
HttpTransport()
|
Method Summary | |
---|---|
protected abstract LowLevelHttpRequest |
buildDeleteRequest(String url)
Builds a DELETE request. |
protected abstract LowLevelHttpRequest |
buildGetRequest(String url)
Builds a GET request. |
protected LowLevelHttpRequest |
buildHeadRequest(String url)
Builds a HEAD request. |
protected LowLevelHttpRequest |
buildPatchRequest(String url)
Builds a PATCH request. |
protected abstract LowLevelHttpRequest |
buildPostRequest(String url)
Builds a POST request. |
protected abstract LowLevelHttpRequest |
buildPutRequest(String url)
Builds a PUT request. |
HttpRequestFactory |
createRequestFactory()
Returns a new instance of an HTTP request factory based on this HTTP transport. |
HttpRequestFactory |
createRequestFactory(HttpRequestInitializer initializer)
Returns a new instance of an HTTP request factory based on this HTTP transport with the given HTTP request initializer. |
void |
shutdown()
Default implementation does nothing, but subclasses may override to possibly release allocated system resources or close connections. |
boolean |
supportsHead()
Returns whether this HTTP transport implementation supports the HEAD request method. |
boolean |
supportsPatch()
Returns whether this HTTP transport implementation supports the PATCH request method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpTransport()
Method Detail |
---|
public final HttpRequestFactory createRequestFactory()
public final HttpRequestFactory createRequestFactory(HttpRequestInitializer initializer)
initializer
- HTTP request initializer or null
for none
public boolean supportsHead()
HEAD
request method.
Default implementation returns false
.
public boolean supportsPatch()
PATCH
request method.
Default implementation returns false
.
protected abstract LowLevelHttpRequest buildDeleteRequest(String url) throws IOException
DELETE
request.
url
- URL
IOException
- I/O exceptionprotected abstract LowLevelHttpRequest buildGetRequest(String url) throws IOException
GET
request.
url
- URL
IOException
- I/O exceptionprotected LowLevelHttpRequest buildHeadRequest(String url) throws IOException
HEAD
request. Won't be called if supportsHead()
returns false
.
Default implementation throws an UnsupportedOperationException
.
url
- URL
IOException
- I/O exceptionprotected LowLevelHttpRequest buildPatchRequest(String url) throws IOException
PATCH
request. Won't be called if supportsPatch()
returns false
.
Default implementation throws an UnsupportedOperationException
.
url
- URL
IOException
- I/O exceptionprotected abstract LowLevelHttpRequest buildPostRequest(String url) throws IOException
POST
request.
url
- URL
IOException
- I/O exceptionprotected abstract LowLevelHttpRequest buildPutRequest(String url) throws IOException
PUT
request.
url
- URL
IOException
- I/O exceptionpublic void shutdown() throws IOException
IOException
- I/O exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |