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 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)
Deprecated.
|
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(HttpMethod method,
GenericUrl url,
HttpContent content)
Deprecated.
(scheduled to be removed in 1.14) Use
buildRequest(String, GenericUrl, HttpContent) instead |
HttpRequest |
buildRequest(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.
@Deprecated public HttpRequest buildRequest(HttpMethod method, GenericUrl url, HttpContent content) throws IOException
buildRequest(String, GenericUrl, HttpContent)
insteadmethod
- HTTP request methodurl
- HTTP request URL or null
for nonecontent
- HTTP request content or null
for noneIOException
public HttpRequest buildRequest(String requestMethod, GenericUrl url, HttpContent content) throws IOException
requestMethod
- HTTP request methodurl
- HTTP request URL or null
for nonecontent
- HTTP request content or null
for noneIOException
public HttpRequest buildDeleteRequest(GenericUrl url) throws IOException
DELETE
request for the given URL.url
- HTTP request URL or null
for noneIOException
public HttpRequest buildGetRequest(GenericUrl url) throws IOException
GET
request for the given URL.url
- HTTP request URL or null
for noneIOException
public HttpRequest buildPostRequest(GenericUrl url, HttpContent content) throws IOException
POST
request for the given URL and content.url
- HTTP request URL or null
for nonecontent
- HTTP request content or null
for noneIOException
public HttpRequest buildPutRequest(GenericUrl url, HttpContent content) throws IOException
PUT
request for the given URL and content.url
- HTTP request URL or null
for nonecontent
- HTTP request content or null
for noneIOException
@Deprecated public HttpRequest buildPatchRequest(GenericUrl url, HttpContent content) throws IOException
PATCH
request for the given URL and content.url
- HTTP request URL or null
for nonecontent
- HTTP request content or null
for noneIOException
public HttpRequest buildHeadRequest(GenericUrl url) throws IOException
HEAD
request for the given URL.url
- HTTP request URL or null
for noneIOException
Copyright © 2011-2012 Google. All Rights Reserved.