public final class HttpRequestFactory extends 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
Builds a
DELETE request for the given URL.
|
HttpRequest |
buildGetRequest(GenericUrl
Builds a
GET request for the given URL.
|
HttpRequest |
buildHeadRequest(GenericUrl
Builds a
HEAD request for the given URL.
|
HttpRequest |
buildPatchRequest(GenericUrl
Builds a
PATCH request for the given URL and content.
|
HttpRequest |
buildPostRequest(GenericUrl
Builds a
POST request for the given URL and content.
|
HttpRequest |
buildPutRequest(GenericUrl
Builds a
PUT request for the given URL and content.
|
HttpRequest |
buildRequest(String
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 HttpTransportgetTransport()
public HttpRequestInitializergetInitializer()
null for none.
This initializer is invoked before setting its method, URL, or content.
public HttpRequestbuildRequest(String requestMethod, GenericUrl url, HttpContent content) throws IOException
requestMethod - HTTP request method
url - HTTP request URL or
null for none
content - HTTP request content or
null for none
IOException
public HttpRequestbuildDeleteRequest(GenericUrl url) throws IOException
DELETE request for the given URL.
url - HTTP request URL or
null for none
IOException
public HttpRequestbuildGetRequest(GenericUrl url) throws IOException
GET request for the given URL.
url - HTTP request URL or
null for none
IOException
public HttpRequestbuildPostRequest(GenericUrl url, HttpContent content) throws IOException
POST request for the given URL and content.
url - HTTP request URL or
null for none
content - HTTP request content or
null for none
IOException
public HttpRequestbuildPutRequest(GenericUrl url, HttpContent content) throws IOException
PUT request for the given URL and content.
url - HTTP request URL or
null for none
content - HTTP request content or
null for none
IOException
public HttpRequestbuildPatchRequest(GenericUrl url, HttpContent content) throws IOException
PATCH request for the given URL and content.
url - HTTP request URL or
null for none
content - HTTP request content or
null for none
IOException
public HttpRequestbuildHeadRequest(GenericUrl url) throws IOException
HEAD request for the given URL.
url - HTTP request URL or
null for none
IOException