public final class HttpRequestFactory
extends java.lang.Object
HTTP request initializer for initializing requests.
For example, to use a particular authorization header across all requests, use:
public static HttpRequestFactory createRequestFactory(HttpTransport transport) {
return transport.createRequestFactory(new HttpRequestInitializer() {
public void initialize(HttpRequest request) throws IOException {
request.getHeaders().setAuthorization("...");
}
});
}
| Modifier and Type | Method and Description |
|---|---|
HttpRequest |
buildDeleteRequest(GenericUrl url)
Builds a
DELETE request for the given URL. |
HttpRequest |
buildGetRequest(GenericUrl url)
Builds a
GET request for the given URL. |
HttpRequest |
buildHeadRequest(GenericUrl url)
Builds a
HEAD request for the given URL. |
HttpRequest |
buildPatchRequest(GenericUrl url,
HttpContent content)
Builds a
PATCH request for the given URL and content. |
HttpRequest |
buildPostRequest(GenericUrl url,
HttpContent content)
Builds a
POST request for the given URL and content. |
HttpRequest |
buildPutRequest(GenericUrl url,
HttpContent content)
Builds a
PUT request for the given URL and content. |
HttpRequest |
buildRequest(java.lang.String requestMethod,
GenericUrl url,
HttpContent content)
Builds a request for the given HTTP method, URL, and content.
|
HttpRequestInitializer |
getInitializer()
Returns the HTTP request initializer or
null for none. |
HttpTransport |
getTransport()
Returns the HTTP transport.
|
public HttpTransport getTransport()
public HttpRequestInitializer getInitializer()
null for none.
This initializer is invoked before setting its method, URL, or content.
public HttpRequest buildRequest(java.lang.String requestMethod, GenericUrl url, HttpContent content) throws java.io.IOException
requestMethod - HTTP request methodurl - HTTP request URL or null for nonecontent - HTTP request content or null for nonejava.io.IOExceptionpublic HttpRequest buildDeleteRequest(GenericUrl url) throws java.io.IOException
DELETE request for the given URL.url - HTTP request URL or null for nonejava.io.IOExceptionpublic HttpRequest buildGetRequest(GenericUrl url) throws java.io.IOException
GET request for the given URL.url - HTTP request URL or null for nonejava.io.IOExceptionpublic HttpRequest buildPostRequest(GenericUrl url, HttpContent content) throws java.io.IOException
POST request for the given URL and content.url - HTTP request URL or null for nonecontent - HTTP request content or null for nonejava.io.IOExceptionpublic HttpRequest buildPutRequest(GenericUrl url, HttpContent content) throws java.io.IOException
PUT request for the given URL and content.url - HTTP request URL or null for nonecontent - HTTP request content or null for nonejava.io.IOExceptionpublic HttpRequest buildPatchRequest(GenericUrl url, HttpContent content) throws java.io.IOException
PATCH request for the given URL and content.url - HTTP request URL or null for nonecontent - HTTP request content or null for nonejava.io.IOExceptionpublic HttpRequest buildHeadRequest(GenericUrl url) throws java.io.IOException
HEAD request for the given URL.url - HTTP request URL or null for nonejava.io.IOExceptionCopyright © 2011-2018 Google. All Rights Reserved.