Class UrlFetchTransport (1.43.0)

public final class UrlFetchTransport extends HttpTransport

Thread-safe HTTP transport for Google App Engine based on URL Fetch.

Implementation is thread-safe. For maximum efficiency, applications should use a single globally-shared instance of the HTTP transport.

URL Fetch is only available on Google App Engine (not on any other Java environment), and is the underlying HTTP transport used for App Engine. Their implementation of HttpURLConnection is simply an abstraction layer on top of URL Fetch. By implementing a transport that directly uses URL Fetch, we can optimize the behavior slightly, and can potentially take advantage of features in URL Fetch that are not available in HttpURLConnection. Furthermore, there is currently a serious bug in how HTTP headers are processed in the App Engine implementation of HttpURLConnection, which we are able to avoid using this implementation. Therefore, this is the recommended transport to use on App Engine.

Inheritance

java.lang.Object > HttpTransport > UrlFetchTransport

Static Methods

getDefaultInstance()

public static UrlFetchTransport getDefaultInstance()

Returns a global thread-safe instance.

Returns
TypeDescription
UrlFetchTransport

Constructors

UrlFetchTransport()

public UrlFetchTransport()

Constructor with the default fetch options.

Use Builder to modify fetch options.

Methods

buildRequest(String method, String url)

protected UrlFetchRequest buildRequest(String method, String url)

Builds a low level HTTP request for the given HTTP method.

Parameters
NameDescription
methodString
urlString
Returns
TypeDescription
com.google.api.client.extensions.appengine.http.UrlFetchRequest
Overrides Exceptions
TypeDescription
IOException

supportsMethod(String method)

public boolean supportsMethod(String method)

Returns whether a specified HTTP method is supported by this transport.

Default implementation returns true if and only if the request method is "DELETE", "GET", "POST", or "PUT". Subclasses should override.

Parameter
NameDescription
methodString
Returns
TypeDescription
boolean
Overrides