public abstract class AbstractGoogleJsonClientRequest<T> extends AbstractGoogleClientRequest<T>
Inheritance
Object > java.util.AbstractMap > com.google.api.client.util.GenericData > AbstractGoogleClientRequest > AbstractGoogleJsonClientRequest<T>Type Parameter
Name | Description |
T |
Constructors
AbstractGoogleJsonClientRequest(AbstractGoogleJsonClient abstractGoogleJsonClient, String requestMethod, String uriTemplate, Object jsonContent, Class<T> responseClass)
protected AbstractGoogleJsonClientRequest(AbstractGoogleJsonClient abstractGoogleJsonClient, String requestMethod, String uriTemplate, Object jsonContent, Class<T> responseClass)
Name | Description |
abstractGoogleJsonClient | AbstractGoogleJsonClient Google JSON client |
requestMethod | String HTTP Method |
uriTemplate | String URI template for the path relative to the base URL. 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) |
jsonContent | Object POJO that can be serialized into JSON content or |
responseClass | Class<T> response class to parse into |
Methods
getAbstractGoogleClient()
public AbstractGoogleJsonClient getAbstractGoogleClient()
Returns the Google client.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Type | Description |
AbstractGoogleJsonClient |
getJsonContent()
public Object getJsonContent()
Returns POJO that can be serialized into JSON content or null
for none.
Type | Description |
Object |
newExceptionOnError(HttpResponse response)
protected GoogleJsonResponseException newExceptionOnError(HttpResponse response)
Returns the exception to throw on an HTTP error response as defined by HttpResponse#isSuccessStatusCode().
It is guaranteed that HttpResponse#isSuccessStatusCode() is false
. Default
implementation is to call HttpResponseException#HttpResponseException(HttpResponse),
but subclasses may override.
Name | Description |
response | com.google.api.client.http.HttpResponse |
Type | Description |
GoogleJsonResponseException |
queue(BatchRequest batchRequest, JsonBatchCallback<T> callback)
public final void queue(BatchRequest batchRequest, JsonBatchCallback<T> callback)
Queues the request into the specified batch request container.
Batched requests are then executed when BatchRequest#execute() is called.
Example usage:
request.queue(batchRequest, new JsonBatchCallback<SomeResponseType>() {
public void onSuccess(SomeResponseType content, HttpHeaders responseHeaders) {
log("Success");
}
public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
log(e.getMessage());
}
});
Name | Description |
batchRequest | BatchRequest batch request container |
callback | JsonBatchCallback<T> batch callback |
Type | Description |
IOException |
set(String fieldName, Object value)
public AbstractGoogleJsonClientRequest<T> set(String fieldName, Object value)
Name | Description |
fieldName | String |
value | Object |
Type | Description |
AbstractGoogleJsonClientRequest<T> |
setDisableGZipContent(boolean disableGZipContent)
public AbstractGoogleJsonClientRequest<T> setDisableGZipContent(boolean disableGZipContent)
Sets whether to disable GZip compression of HTTP content.
By default it is false
.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
disableGZipContent | boolean |
Type | Description |
AbstractGoogleJsonClientRequest<T> |
setRequestHeaders(HttpHeaders headers)
public AbstractGoogleJsonClientRequest<T> setRequestHeaders(HttpHeaders headers)
Sets the HTTP headers used for the Google client request.
These headers are set on the request after #buildHttpRequest is called, this means that HttpRequestInitializer#initialize is called first.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
headers | com.google.api.client.http.HttpHeaders |
Type | Description |
AbstractGoogleJsonClientRequest<T> |