public static class

HttpGDataRequest.Factory

extends Object
implements Service.GDataRequestFactory
java.lang.Object
   ↳ com.google.gdata.client.http.HttpGDataRequest.Factory
Known Direct Subclasses

Class Overview

The HttpGDataRequest.Factory class is a factory class for constructing new HttpGDataRequest instances.

Summary

Fields
protected HttpAuthToken authToken
protected HttpUrlConnectionSource connectionSource
protected Map<String, String> headerMap
protected Map<String, String> privateHeaderMap
protected boolean useSsl
Public Constructors
HttpGDataRequest.Factory()
Public Methods
Service.GDataRequest getRequest(Service.GDataRequest.RequestType type, URL requestUrl, ContentType contentType)
Creates a new GDataRequest instance of the specified RequestType.
Service.GDataRequest getRequest(Query query, ContentType contentType)
Creates a new GDataRequest instance for querying a service.
void setAuthToken(HttpAuthToken authToken)
void setAuthToken(AuthTokenFactory.AuthToken authToken)
Set authentication token to be used on subsequent requests created via getRequest(com.google.gdata.client.Service.GDataRequest.RequestType, URL, ContentType).
void setConnectionSource(HttpUrlConnectionSource connectionSource)
Sets a specific HttpUrlConnectionSource instance to create backing URLConnection instance.
void setHeader(String header, String value)
Set a header that will be included in all requests.
void setPrivateHeader(String header, String value)
Set a header that will be included in all requests and do not log the value.
void useSsl()
Protected Methods
Service.GDataRequest createRequest(Service.GDataRequest.RequestType type, URL requestUrl, ContentType contentType)
Creates a Service.GDataRequest instance.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gdata.client.Service.GDataRequestFactory

Fields

protected HttpAuthToken authToken

protected HttpUrlConnectionSource connectionSource

protected Map<String, String> headerMap

protected Map<String, String> privateHeaderMap

protected boolean useSsl

Public Constructors

public HttpGDataRequest.Factory ()

Public Methods

public Service.GDataRequest getRequest (Service.GDataRequest.RequestType type, URL requestUrl, ContentType contentType)

Creates a new GDataRequest instance of the specified RequestType.

Clients should be sure to call end() on the returned request once they have finished using it.

Parameters
type The request type
requestUrl The target URL for the request
contentType The contentType of the data being provided in the request body. May be null if no data is provided.
Throws
IOException
ServiceException

public Service.GDataRequest getRequest (Query query, ContentType contentType)

Creates a new GDataRequest instance for querying a service. This method pushes the query parameters down to the factory method instead of serializing them as a URL. Some factory implementations prefer to get access to query parameters in their original form, not as a URL.

Clients should be sure to call end() on the returned request once they have finished using it.

Parameters
query The query associated with the request
contentType This parameter is unused but remains for backwards compatibility.
Throws
IOException
ServiceException

public void setAuthToken (HttpAuthToken authToken)

Parameters
authToken

public void setAuthToken (AuthTokenFactory.AuthToken authToken)

Set authentication token to be used on subsequent requests created via getRequest(com.google.gdata.client.Service.GDataRequest.RequestType, URL, ContentType). An IllegalArgumentException is thrown if an auth token of the wrong type is passed, or if authentication is not supported.

Parameters
authToken Authentication token.

public void setConnectionSource (HttpUrlConnectionSource connectionSource)

Sets a specific HttpUrlConnectionSource instance to create backing URLConnection instance.

Parameters
connectionSource

public void setHeader (String header, String value)

Set a header that will be included in all requests. If header of the same name was previously set, then replace the previous header value.

Parameters
header The name of the header
value The value of the header, if null, then unset that header.

public void setPrivateHeader (String header, String value)

Set a header that will be included in all requests and do not log the value. Useful for values that are sensitive or related to security. If header of the same name was previously set, then replace the previous header value.

Parameters
header The name of the header
value The value of the header. If null, then unset that header.

public void useSsl ()

Protected Methods

protected Service.GDataRequest createRequest (Service.GDataRequest.RequestType type, URL requestUrl, ContentType contentType)

Creates a Service.GDataRequest instance.

This method is called from getRequest(Query, ContentType) after any changes to the parameters have been applied.

Subclasses should overwrite this method and not getRequest(Query, ContentType)

Parameters
type
requestUrl
contentType
Throws
IOException
ServiceException