|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.api.client.googleapis.MethodOverride
public final class MethodOverride
HTTP request execute interceptor for Google API's that wraps HTTP requests -- other than GET or
POST -- inside of a POST request and uses "X-HTTP-Method-Override"
header to specify the
actual HTTP method.
Use this 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(EnumSet)
constructor instead to specify additional
methods to override. GET and POST are never overridden.
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.
Constructor Summary | |
---|---|
MethodOverride()
Only overrides HTTP methods that the HTTP transport does not support. |
|
MethodOverride(EnumSet<HttpMethod> override)
Specifies the HTTP methods to override. |
Method Summary | |
---|---|
void |
initialize(HttpRequest request)
|
void |
intercept(HttpRequest request)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MethodOverride()
public MethodOverride(EnumSet<HttpMethod> override)
override
- HTTP methods supported by the HTTP transport that nevertheless need to be
overriddenMethod Detail |
---|
public void initialize(HttpRequest request)
initialize
in interface HttpRequestInitializer
public void intercept(HttpRequest request)
intercept
in interface HttpExecuteInterceptor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |