public static class HttpGDataRequest.Factory extends java.lang.Object implements Service.GDataRequestFactory
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
HttpGDataRequest.Factory() |
Modifier and Type | Method and Description |
---|---|
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() |
protected HttpAuthToken authToken
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
protected HttpUrlConnectionSource connectionSource
public void setAuthToken(AuthTokenFactory.AuthToken authToken)
Service.GDataRequestFactory
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.setAuthToken
in interface Service.GDataRequestFactory
authToken
- Authentication token.public void setAuthToken(HttpAuthToken authToken)
public void useSsl()
public void setHeader(java.lang.String header, java.lang.String value)
Service.GDataRequestFactory
setHeader
in interface Service.GDataRequestFactory
header
- the name of the headervalue
- the value of the header, if null, then unset that header.public void setPrivateHeader(java.lang.String header, java.lang.String value)
Service.GDataRequestFactory
setPrivateHeader
in interface Service.GDataRequestFactory
header
- the name of the headervalue
- the value of the header. If null, then unset that header.public void setConnectionSource(HttpUrlConnectionSource connectionSource)
HttpUrlConnectionSource
instance to create
backing URLConnection
instance.public Service.GDataRequest getRequest(Service.GDataRequest.RequestType type, java.net.URL requestUrl, ContentType contentType) throws java.io.IOException, ServiceException
Service.GDataRequestFactory
Clients should be sure to call Service.GDataRequest.end()
on the returned
request once they have finished using it.
getRequest
in interface Service.GDataRequestFactory
type
- the request typerequestUrl
- the target URL for the requestcontentType
- the contentType of the data being provided in the
request body. May be null
if no data is provided.java.io.IOException
ServiceException
public Service.GDataRequest getRequest(Query query, ContentType contentType) throws java.io.IOException, ServiceException
Service.GDataRequestFactory
Clients should be sure to call Service.GDataRequest.end()
on the returned
request once they have finished using it.
getRequest
in interface Service.GDataRequestFactory
query
- the query associated with the requestcontentType
- this parameter is unused but remains for backwards
compatibility.java.io.IOException
ServiceException
protected Service.GDataRequest createRequest(Service.GDataRequest.RequestType type, java.net.URL requestUrl, ContentType contentType) throws java.io.IOException, ServiceException
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)
java.io.IOException
ServiceException