Class AbstractGoogleJsonClientRequest<T> (1.35.2)

public abstract class AbstractGoogleJsonClientRequest<T> extends AbstractGoogleClientRequest<T>

Google JSON request for a AbstractGoogleJsonClient.

Implementation is not thread-safe.

Inheritance

Object > java.util.AbstractMap > com.google.api.client.util.GenericData > AbstractGoogleClientRequest > AbstractGoogleJsonClientRequest<T>

Type Parameter

NameDescription
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)
Parameters
NameDescription
abstractGoogleJsonClientAbstractGoogleJsonClient

Google JSON client

requestMethodString

HTTP Method

uriTemplateString

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)

jsonContentObject

POJO that can be serialized into JSON content or null for none

responseClassClass<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.

Returns
TypeDescription
AbstractGoogleJsonClient
Overrides

getJsonContent()

public Object getJsonContent()

Returns POJO that can be serialized into JSON content or null for none.

Returns
TypeDescription
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.

Parameter
NameDescription
responsecom.google.api.client.http.HttpResponse
Returns
TypeDescription
GoogleJsonResponseException
Overrides

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());
   }
 });
 
Parameters
NameDescription
batchRequestBatchRequest

batch request container

callbackJsonBatchCallback<T>

batch callback

Exceptions
TypeDescription
IOException

set(String fieldName, Object value)

public AbstractGoogleJsonClientRequest<T> set(String fieldName, Object value)
Parameters
NameDescription
fieldNameString
valueObject
Returns
TypeDescription
AbstractGoogleJsonClientRequest<T>
Overrides

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.

Parameter
NameDescription
disableGZipContentboolean
Returns
TypeDescription
AbstractGoogleJsonClientRequest<T>
Overrides

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.

Parameter
NameDescription
headerscom.google.api.client.http.HttpHeaders
Returns
TypeDescription
AbstractGoogleJsonClientRequest<T>
Overrides