Google Data APIs Client Library (1.41.1)



com.google.gdata.client.http
Class HttpGDataRequest.Factory

java.lang.Object
  extended by com.google.gdata.client.http.HttpGDataRequest.Factory
All Implemented Interfaces:
Service.GDataRequestFactory
Direct Known Subclasses:
GoogleGDataRequest.Factory
Enclosing class:
HttpGDataRequest

public static class HttpGDataRequest.Factory
extends java.lang.Object
implements Service.GDataRequestFactory

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


Field Summary
protected  HttpAuthToken authToken
           
protected  HttpUrlConnectionSource connectionSource
           
protected  java.util.Map<java.lang.String,java.lang.String> headerMap
           
protected  java.util.Map<java.lang.String,java.lang.String> privateHeaderMap
           
protected  boolean useSsl
           
 
Constructor Summary
HttpGDataRequest.Factory()
           
 
Method Summary
protected  Service.GDataRequest createRequest(Service.GDataRequest.RequestType type, java.net.URL requestUrl, ContentType contentType)
          Creates a Service.GDataRequest instance.
 Service.GDataRequest getRequest(Query query, ContentType contentType)
          Creates a new GDataRequest instance for querying a service.
 Service.GDataRequest getRequest(Service.GDataRequest.RequestType type, java.net.URL requestUrl, ContentType contentType)
          Creates a new GDataRequest instance of the specified RequestType.
 void setAuthToken(AuthTokenFactory.AuthToken authToken)
          Set authentication token to be used on subsequent requests created via Service.GDataRequestFactory.getRequest( com.google.gdata.client.Service.GDataRequest.RequestType, URL, ContentType).
 void setAuthToken(HttpAuthToken authToken)
           
 void setConnectionSource(HttpUrlConnectionSource connectionSource)
          Sets a specific HttpUrlConnectionSource instance to create backing URLConnection instance.
 void setHeader(java.lang.String header, java.lang.String value)
          Set a header that will be included in all requests.
 void setPrivateHeader(java.lang.String header, java.lang.String value)
          Set a header that will be included in all requests and do not log the value.
 void useSsl()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

authToken

protected HttpAuthToken authToken

headerMap

protected java.util.Map<java.lang.String,java.lang.String> headerMap

privateHeaderMap

protected java.util.Map<java.lang.String,java.lang.String> privateHeaderMap

useSsl

protected boolean useSsl

connectionSource

protected HttpUrlConnectionSource connectionSource
Constructor Detail

HttpGDataRequest.Factory

public HttpGDataRequest.Factory()
Method Detail

setAuthToken

public void setAuthToken(AuthTokenFactory.AuthToken authToken)
Description copied from interface: Service.GDataRequestFactory
Set authentication token to be used on subsequent requests created via Service.GDataRequestFactory.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.

Specified by:
setAuthToken in interface Service.GDataRequestFactory
Parameters:
authToken - Authentication token.

setAuthToken

public void setAuthToken(HttpAuthToken authToken)

useSsl

public void useSsl()

setHeader

public void setHeader(java.lang.String header,
                      java.lang.String value)
Description copied from interface: Service.GDataRequestFactory
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.

Specified by:
setHeader in interface Service.GDataRequestFactory
Parameters:
header - the name of the header
value - the value of the header, if null, then unset that header.

setPrivateHeader

public void setPrivateHeader(java.lang.String header,
                             java.lang.String value)
Description copied from interface: Service.GDataRequestFactory
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.

Specified by:
setPrivateHeader in interface Service.GDataRequestFactory
Parameters:
header - the name of the header
value - the value of the header. If null, then unset that header.

setConnectionSource

public void setConnectionSource(HttpUrlConnectionSource connectionSource)
Sets a specific HttpUrlConnectionSource instance to create backing URLConnection instance.


getRequest

public Service.GDataRequest getRequest(Service.GDataRequest.RequestType type,
                                       java.net.URL requestUrl,
                                       ContentType contentType)
                                throws java.io.IOException,
                                       ServiceException
Description copied from interface: Service.GDataRequestFactory
Creates a new GDataRequest instance of the specified RequestType.

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

Specified by:
getRequest in interface Service.GDataRequestFactory
Throws:
java.io.IOException
ServiceException

getRequest

public Service.GDataRequest getRequest(Query query,
                                       ContentType contentType)
                                throws java.io.IOException,
                                       ServiceException
Description copied from interface: Service.GDataRequestFactory
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 Service.GDataRequest.end() on the returned request once they have finished using it.

Specified by:
getRequest in interface Service.GDataRequestFactory
Throws:
java.io.IOException
ServiceException

createRequest

protected Service.GDataRequest createRequest(Service.GDataRequest.RequestType type,
                                             java.net.URL requestUrl,
                                             ContentType contentType)
                                      throws java.io.IOException,
                                             ServiceException
Creates a Service.GDataRequest instance.

This method is called from getRequest(com.google.gdata.client.Service.GDataRequest.RequestType, java.net.URL, com.google.gdata.util.ContentType) after any changes to the parameters have been applied.

Subclasses should overwrite this method and not getRequest(com.google.gdata.client.Service.GDataRequest.RequestType, java.net.URL, com.google.gdata.util.ContentType)

Throws:
java.io.IOException
ServiceException