Package (2.1.2)

Google APIs.



Utility class for the Google API Client Library.


Thread-safe HTTP request execute interceptor for Google API's that wraps HTTP requests inside of a POST request and uses #HEADER header to specify the actual HTTP method.

Use this for example for an HTTP transport that doesn't support PATCH like NetHttpTransport or UrlFetchTransport. By default, only the methods not supported by the transport will be overridden. When running behind a firewall that does not support certain verbs like PATCH, use the MethodOverride.Builder#setOverrideAllMethods(boolean) constructor instead to specify to override all methods. POST is never overridden.

This class also allows GET requests with a long URL (> 2048 chars) to be instead sent using method override as a POST request.

Sample usage, taking advantage that this class implements HttpRequestInitializer:

 public static HttpRequestFactory createRequestFactory(HttpTransport transport) {
   return transport.createRequestFactory(new MethodOverride());

If you have a custom request initializer, take a look at the sample usage for HttpExecuteInterceptor, which this class also implements.


Builder for MethodOverride.