| java.lang.Object | ||
| ↳ | com.google.gdata.client.Service | |
| ↳ | com.google.gdata.client.GoogleService | |
Known Direct Subclasses
|
The GoogleService class extends the basic GData Service
abstraction to add support for authentication and cookies.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| GoogleService.AccountDeletedException | Authentication failed, account has been deleted. | ||||||||||
| GoogleService.AccountDisabledException | Authentication failed, account has been disabled. | ||||||||||
| GoogleService.CaptchaRequiredException | Authentication failed, CAPTCHA requires answering. | ||||||||||
| GoogleService.InvalidCredentialsException | Authentication failed, invalid credentials presented to server. | ||||||||||
| GoogleService.NotVerifiedException | Authentication failed, account has not been verified. | ||||||||||
| GoogleService.ServiceUnavailableException | Authentication failed, authentication service not available. | ||||||||||
| GoogleService.SessionExpiredException | Authentication failed, the token's session has expired. | ||||||||||
| GoogleService.TermsNotAgreedException | Authentication failed, user did not agree to the terms of service. | ||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| authTokenFactory | |||||||||||
| cookieManager | |||||||||||
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gdata.client.Service
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a GoogleService instance connecting to the service with name
serviceName for an application with the name
applicationName. | |||||||||||
Constructs a GoogleService instance connecting to the service with name
serviceName for an application with the name
applicationName. | |||||||||||
Constructs a GoogleService instance connecting to the service for an
application with the name
applicationName. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Adds a new GoogleCookie instance to the cache.
| |||||||||||
Executes several operations (insert, update or delete) on the entries that
are part of the input
IFeed. | |||||||||||
Creates a new GDataRequest for use by the service.
| |||||||||||
Deletes an existing entry (and associated media content, if any) using the
specified edit URL.
| |||||||||||
Deletes an existing entry (and associated media content, if any) using the
specified edit URL.
| |||||||||||
Retrieves the authentication token for the provided set of credentials.
| |||||||||||
Returns the
AuthTokenFactory currently associated with the service. | |||||||||||
Returns the
CookieManager currently associated with the service. | |||||||||||
Returns the set of associated cookies returned by previous requests.
| |||||||||||
Returns an Atom entry instance given the URL of the entry, if its current
entity tag is different than the provided value.
| |||||||||||
Returns an Atom entry instance, given the URL of the entry and an
if-modified-since date.
| |||||||||||
Returns the Feed associated with a particular feed URL, if it's been
modified since the specified date.
| |||||||||||
Returns the Feed resulting from executing a query, if it's been modified
since the specified date.
| |||||||||||
Returns the Feed resulting from query execution, if if the entity tag
associated with it has changed.
| |||||||||||
Returns the Feed associated with a particular feed URL if the entity tag
associated with it has changed.
| |||||||||||
Returns
true if the GoogleService is handling cookies. | |||||||||||
Inserts a new
IEntry into a feed associated
with the target service. | |||||||||||
Makes a HTTP POST request to the provided
url given the
provided parameters. | |||||||||||
Sets the AuthSub token to be used to authenticate a user.
| |||||||||||
Sets the AuthSub token to be used to authenticate a user.
| |||||||||||
Sets the
AuthTokenFactory currently associated with the service. | |||||||||||
Sets the
CookieManager currently associated with the service. | |||||||||||
Enables or disables cookie handling.
| |||||||||||
Sets the OAuth 2.0 credentials used to generate the authorization header.
| |||||||||||
Sets the OAuth credentials used to generate the authorization header.
| |||||||||||
Sets the credentials of the user to authenticate requests to the server.
| |||||||||||
Sets the credentials of the user to authenticate requests to the server.
| |||||||||||
Sets the credentials of the user to authenticate requests to the server.
| |||||||||||
Sets the credentials of the user to authenticate requests to the server.
| |||||||||||
Sets the AuthToken that should be used to authenticate requests to the
server.
| |||||||||||
Updates an existing
IEntry by writing it to
the specified entry edit URL. | |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new GDataRequest for querying the service.
| |||||||||||
Handles a redirect exception by generating the new URL to use for the
redirect.
| |||||||||||
Delegates session expired exception to
AuthTokenFactory. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gdata.client.Service
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.google.gdata.client.AuthTokenFactory.TokenListener
| |||||||||||
Constructs a GoogleService instance connecting to the service with name
serviceName for an application with the name
applicationName. The default domain (www.google.com) and the
default Google authentication methods will be used to authenticate.
A simple cookie manager is used.
| serviceName | The name of the Google service to which we are connecting. Sample names of services might include "cl" (Calendar), "mail" (GMail), or "blogger" (Blogger) |
|---|---|
| applicationName | The name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication. |
Constructs a GoogleService instance connecting to the service with name
serviceName for an application with the name
applicationName. The service will authenticate at the provided
domainName. The default Google authentication methods will be
used to authenticate. A simple cookie manager is used.
| serviceName | The name of the Google service to which we are connecting. Sample names of services might include "cl" (Calendar), "mail" (GMail), or "blogger" (Blogger) |
|---|---|
| applicationName | The name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication. |
| protocol | Name of protocol to use for authentication ("http"/"https") |
| domainName | The name of the domain hosting the login handler |
Constructs a GoogleService instance connecting to the service for an
application with the name applicationName. The provided
GDataRequestFactory will create requests, and the given
AuthTokenFactory will be used to generate auth tokens.
A simple cookie manager is used.
| applicationName | The name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication. |
|---|---|
| requestFactory | The request factory that generates gdata requests |
| authTokenFactory | The auth token factory that generates auth tokens |
Adds a new GoogleCookie instance to the cache.
| cookie |
|---|
Executes several operations (insert, update or delete) on the entries that
are part of the input IFeed. It will return another feed that
describes what was done while executing these operations.
It is possible for one batch operation to fail even though other operations
have worked, so this method won't throw a ServiceException unless something
really wrong is going on. You need to check the entries in the returned
feed to know which operations succeeded and which operations failed (see
BatchStatus and
BatchInterrupted extensions.)
| feedUrl | The POST URI associated with the target feed. |
|---|---|
| inputFeed | A description of the operations to execute, described using tags in the batch: namespace |
| IOException | error communicating with the GData service. |
|---|---|
| ParseException | error parsing the return entry data. |
| ServiceException | insert request failed due to system error. |
| BatchInterruptedException | if something really wrong was detected by
the server while parsing the request, like invalid XML data. Some
operations might have succeeded when this exception is thrown.
Check getIFeed().
|
Creates a new GDataRequest for use by the service.
Clients should be sure to call end() on the
returned request once they have finished using it.
| type | |
|---|---|
| requestUrl | |
| contentType |
| IOException | |
|---|---|
| ServiceException |
Deletes an existing entry (and associated media content, if any) using the specified edit URL. This delete is conditional upon the provided tag matching the current entity tag for the entry. If (and only if) they match, the deletion will be performed.
| entryUrl | The edit or medit edit url associated with the resource. |
|---|---|
| etag | The entity tag value that is the expected value for the target
resource. A value of null will not set an etag
precondition and a value of "*" will perform an
unconditional delete. |
| IOException | |
|---|---|
| ServiceException |
Deletes an existing entry (and associated media content, if any) using the specified edit URL.
| entryUrl | The edit or medit edit url associated with the resource. |
|---|
| IOException | |
|---|---|
| ServiceException |
Retrieves the authentication token for the provided set of credentials.
| username | The name of the user (an email address) |
|---|---|
| password | The password of the user |
| captchaToken | The CAPTCHA token if CAPTCHA is required (Optional) |
| captchaAnswer | The respective answer of the CAPTCHA token (Optional) |
| serviceName | The name of the service to which a token is required |
| applicationName | The application requesting the token |
| AuthenticationException | if authentication failed |
|---|
Returns the AuthTokenFactory currently associated with the service.
Returns the CookieManager currently associated with the service.
Returns the set of associated cookies returned by previous requests.
Returns an Atom entry instance given the URL of the entry, if its current entity tag is different than the provided value.
| entryUrl | Resource URL for the entry. |
|---|---|
| entryClass | Class used to represent service entries,
not null. |
| etag | Used to provide an entity tag that indicates the entry should
be returned only if the entity tag of the current representation is
different from the provided value. A value of null indicates
unconditional return. |
| IOException | |
|---|---|
| ServiceException |
Returns an Atom entry instance, given the URL of the entry and an if-modified-since date.
| entryUrl | Resource URL for the entry. |
|---|---|
| entryClass | Class used to represent service entries,
not null. |
| ifModifiedSince | Used to set a precondition date that indicates the
entry should be returned only if it has been modified after the
specified date. A value of null indicates no precondition. |
| IOException | |
|---|---|
| ServiceException |
Returns the Feed associated with a particular feed URL, if it's been modified since the specified date.
| feedUrl | The URL associated with a feed. This URL can include GData query parameters. |
|---|---|
| feedClass | The class used to represent a service Feed. |
| ifModifiedSince | Used to set a precondition date that indicates the
feed should be returned only if it has been modified after the
specified date. A value of null indicates no precondition. |
| IOException | |
|---|---|
| ServiceException |
Returns the Feed resulting from executing a query, if it's been modified since the specified date.
| query | Feed query. |
|---|---|
| feedClass | The class used to represent a service Feed. |
| ifModifiedSince | Used to set a precondition date that indicates the
feed should be returned only if it has been modified after the
specified date. A value of null indicates no precondition. |
| IOException | |
|---|---|
| ServiceException |
Returns the Feed resulting from query execution, if if the entity tag associated with it has changed.
| query | Feed query. |
|---|---|
| feedClass | The class used to represent query results. |
| etag | Used to provide an entity tag that indicates the feed should be
returned only if the entity tag of the current representation is
different from the provided value. A value of null indicates
unconditional return. |
| IOException | |
|---|---|
| ServiceException |
Returns the Feed associated with a particular feed URL if the entity tag associated with it has changed.
| feedUrl | The URL associated with a feed. This URL can include GData query parameters. |
|---|---|
| feedClass | The class used to represent a service Feed. |
| etag | Used to provide an entity tag that indicates the feed should be
returned only if the entity tag of the current representation is
different from the provided value. A value of null indicates
unconditional return. |
| IOException | |
|---|---|
| ServiceException |
Returns true if the GoogleService is handling cookies.
Inserts a new IEntry into a feed associated
with the target service. It will return the inserted entry, including any
additional attributes or extensions set by the GData server.
| feedUrl | The POST URI associated with the target feed. |
|---|---|
| entry | The new entry to insert into the feed. |
| IOException | |
|---|---|
| ServiceException |
Makes a HTTP POST request to the provided url given the
provided parameters. It returns the output from the POST
handler as a String object.
| url | The URL to post the request |
|---|---|
| parameters | The parameters to post to the handler |
| IOException | if an I/O exception occurs while creating, writing, or reading the request |
|---|
Sets the AuthSub token to be used to authenticate a user.
| token | The AuthSub token retrieved from Google |
|---|
Sets the AuthSub token to be used to authenticate a user. The token will be used in secure-mode, and the provided private key will be used to sign all requests.
| token | The AuthSub token retrieved from Google |
|---|---|
| key | The private key to be used to sign all requests |
Sets the AuthTokenFactory currently associated with the service.
| authTokenFactory | Authentication factory |
|---|
Sets the CookieManager currently associated with the service.
| cookieManager | Cookie manager |
|---|
Enables or disables cookie handling.
| handlesCookies |
|---|
Sets the OAuth 2.0 credentials used to generate the authorization header.
| credential | The OAuth 2.0 credentials to use to generate the header |
|---|
Sets the OAuth credentials used to generate the authorization header. This header needs to be set per request, as it depends on the request url. The following OAuth parameters are required:
| parameters | The OAuth parameters to use to generate the header |
|---|---|
| signer | The signing method to use for signing the header |
| OAuthException |
|---|
Sets the credentials of the user to authenticate requests to the server. A CAPTCHA token and a CAPTCHA answer can also be optionally provided to authenticate when the authentication server requires that a CAPTCHA be answered.
| username | The name of the user (an email id) |
|---|---|
| password | The password of the user |
| captchaToken | The CAPTCHA token issued by the server |
| captchaAnswer | The answer to the respective CAPTCHA token |
| AuthenticationException | if authentication failed |
|---|
Sets the credentials of the user to authenticate requests to the server.
| username | The name of the user (an email address) |
|---|---|
| password | The password of the user |
| AuthenticationException | if authentication failed. |
|---|
Sets the credentials of the user to authenticate requests to the server. A CAPTCHA token and a CAPTCHA answer can also be optionally provided to authenticate when the authentication server requires that a CAPTCHA be answered.
| username | The name of the user (an email id) |
|---|---|
| password | The password of the user |
| captchaToken | The CAPTCHA token issued by the server |
| captchaAnswer | The answer to the respective CAPTCHA token |
| accountType | The account type: HOSTED, GOOGLE, or HOSTED_OR_GOOGLE |
| AuthenticationException | if authentication failed |
|---|
Sets the credentials of the user to authenticate requests to the server.
| username | The name of the user (an email address) |
|---|---|
| password | The password of the user |
| accountType | The account type: HOSTED, GOOGLE, or HOSTED_OR_GOOGLE |
| AuthenticationException | if authentication failed. |
|---|
Sets the AuthToken that should be used to authenticate requests to the server. This is useful if the caller has some other way of accessing the AuthToken, versus calling getAuthToken with credentials to request the AuthToken using ClientLogin.
| token | The AuthToken in ascii form |
|---|
Updates an existing IEntry by writing it to
the specified entry edit URL. The resulting Entry (after update) will be
returned.
| entryUrl | The edit URL associated with the entry. |
|---|---|
| entry | The modified Entry to be written to the server. |
| IOException | |
|---|---|
| ServiceException |
Creates a new GDataRequest for querying the service.
Clients should be sure to call end() on the
returned request once they have finished using it.
| query | |
|---|---|
| contentType |
| IOException | |
|---|---|
| ServiceException |
Handles a redirect exception by generating the new URL to use for the redirect.
| redirect |
|---|
| ServiceException |
|---|