HttpRequest
instead.@Deprecated public class JsonHttpRequest extends GenericData
JsonHttpClient
.
Implementation is not thread-safe.
GenericData.Flags
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
JsonHttpRequest(JsonHttpClient client,
HttpMethod method,
String uriTemplate,
Object content)
Deprecated.
Builds an instance of
JsonHttpRequest . |
Modifier and Type | Method and Description |
---|---|
HttpRequest |
buildHttpRequest()
Deprecated.
Create an
HttpRequest suitable for use against this service. |
GenericUrl |
buildHttpRequestUrl()
Deprecated.
Creates a new instance of
GenericUrl suitable for use against this service. |
void |
download(OutputStream outputStream)
Deprecated.
Sends the request to the server and writes the content input stream of
HttpResponse
into the given destination output stream. |
InputStream |
executeAsInputStream()
Deprecated.
Sends the request to the server and returns the content input stream of
HttpResponse . |
HttpResponse |
executeUnparsed()
Deprecated.
Sends the request to the server and returns the raw
HttpResponse . |
JsonHttpClient |
getClient()
Deprecated.
Returns the JSON HTTP client which handles this request.
|
boolean |
getEnableGZipContent()
Deprecated.
Returns whether to enable GZip compression of HTTP content.
|
Object |
getJsonContent()
Deprecated.
Returns a POJO that can be serialized into JSON or
null for none. |
HttpHeaders |
getLastResponseHeaders()
Deprecated.
Gets the HTTP headers of the last response or
null for none. |
HttpMethod |
getMethod()
Deprecated.
Returns the HTTP Method type.
|
HttpHeaders |
getRequestHeaders()
Deprecated.
Gets the HTTP headers used for the JSON HTTP request.
|
String |
getUriTemplate()
Deprecated.
Returns the URI template.
|
JsonHttpRequest |
setEnableGZipContent(boolean enableGZipContent)
Deprecated.
Sets whether to enable GZip compression of HTTP content.
|
JsonHttpRequest |
setRequestHeaders(HttpHeaders headers)
Deprecated.
Sets the HTTP headers used for the JSON HTTP request.
|
clone, entrySet, get, getClassInfo, getUnknownKeys, put, putAll, remove, set, setUnknownKeys
clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, size, toString, values
public JsonHttpRequest(JsonHttpClient client, HttpMethod method, String uriTemplate, Object content)
JsonHttpRequest
.client
- The JSON HTTP client which handles this requestmethod
- HTTP Method typeuriTemplate
- URI template for the path relative to the base URL specified in JSON HTTP
client. If it starts with a "/" the base path from the base URL will be stripped out.
The URI template can also be a full URL. URI template expansion is done using UriTemplate.expand(String, String, Object, boolean)
content
- A POJO that can be serialized into JSON or null
for nonepublic JsonHttpRequest setEnableGZipContent(boolean enableGZipContent)
By default it is true
.
public final boolean getEnableGZipContent()
public final HttpMethod getMethod()
public final String getUriTemplate()
public final Object getJsonContent()
null
for none.public final JsonHttpClient getClient()
public JsonHttpRequest setRequestHeaders(HttpHeaders headers)
These headers are set on the request after buildHttpRequest()
is called, this means that
HttpRequestInitializer.initialize(com.google.api.client.http.HttpRequest)
is called first.
public final HttpHeaders getRequestHeaders()
public final HttpHeaders getLastResponseHeaders()
null
for none.public final GenericUrl buildHttpRequestUrl()
GenericUrl
suitable for use against this service.GenericUrl
public HttpRequest buildHttpRequest() throws IOException
HttpRequest
suitable for use against this service. Subclasses may override if
specific behavior is required.HttpRequest
IOException
public HttpResponse executeUnparsed() throws IOException
HttpResponse
. Subclasses may
override if specific behavior is required.
Callers are responsible for disconnecting the HTTP response by calling
HttpResponse.disconnect()
. Example usage:
HttpResponse response = jsonHttpRequest.executeUnparsed(); try { // process response.. } finally { response.disconnect(); }
HttpResponse
IOException
- if the request failspublic InputStream executeAsInputStream() throws IOException
HttpResponse
.
Subclasses may override if specific behavior is required.
Callers are responsible for closing the input stream after it is processed. Example sample:
InputStream is = request.executeAsInputStream(); try { // Process input stream.. } finally { is.close(); }
IOException
- if the request failspublic void download(OutputStream outputStream) throws IOException
HttpResponse
into the given destination output stream.
This method closes the content of the HTTP response from HttpResponse.getContent()
.
outputStream
- destination output streamIOException
- I/O exceptionCopyright © 2011-2012 Google. All Rights Reserved.