| com.google.gdata.client.Service.GDataRequest |
Known Indirect Subclasses
|
The GDataRequest interface represents a streaming connection to a GData service that can be used either to send request data to the service using an OutputStream (or XmlWriter for XML content) or to receive response data from the service as an InputStream (or ParseSource for XML data). The calling client then has full control of the request data generation and response data parsing. This can be used to integrate GData services with an external Atom or RSS parsing library, such as Rome.
A GDataRequest instance will be returned by the streaming client APIs of the Service class. The basic usage pattern is:
GDataRequest request = ... // createXXXRequest API call
try {
OutputStream requestStream = request.getRequestStream();
// stream request data, if any
request.execute() // execute the request
InputStream responseStream = request.getResponseStream();
// process the response data, if any
}
catch (IOException ioe) {
// handle errors writing to / reading from server
} catch (ServiceException se) {
// handle service invocation errors
} finally {
request.end();
}
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Service.GDataRequest.RequestType | The RequestType enumeration defines the set of expected GData request types. | ||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Ends all processing associated with this request and releases any
transient resources (such as open data streams) required for execution.
| |||||||||||
Executes the GData service request.
| |||||||||||
Returns a parse source that can be used to read response data from the
GData service.
| |||||||||||
Returns the
ContentType of the data that will be written to the
service by this request or null if no data is written to the
server by the request. | |||||||||||
Returns a stream that can be used to write request data to the GData
service.
| |||||||||||
Returns the URL that is the target of the GData request
| |||||||||||
Returns the content type of the GData response.
| |||||||||||
Returns the value of a header containing a header or
null if no
response header of this type exists or it could not be parsed as a valid
date. | |||||||||||
Returns the value of the specified response header name or
null
if no response header of this type exists. | |||||||||||
Returns an input stream that can be used to read response data from the
GData service.
| |||||||||||
Sets the number of milliseconds to wait for a connection to the remote
GData service before timing out.
| |||||||||||
Sets the entity tag value that will be used to conditionalize the request
if not
null. | |||||||||||
Sets a request header (and logs it, if logging is enabled)
| |||||||||||
Sets the If-Modified-Since date precondition to be applied to the
request.
| |||||||||||
Sets request header (and log just the name but not the value, if logging
is enabled)
| |||||||||||
Sets the number of milliseconds to wait for a response from the remote
GData service before timing out.
| |||||||||||
Ends all processing associated with this request and releases any transient resources (such as open data streams) required for execution.
Executes the GData service request.
| IOException | error writing to or reading from GData service. |
|---|---|
| ResourceNotFoundException | invalid request target resource. |
| ServiceException | system error executing request. |
Returns a parse source that can be used to read response data from the GData service. Parse source is an abstraction over input streams, readers, and other forms of input.
The caller is responsible for ensuring that input streams and readers contained in the parse source are properly closed after the response has been read.
| IllegalStateException | attempt to read response without first
calling execute(). |
|---|---|
| IOException | error obtaining the response data. |
| ServiceException | error obtaining the response data. |
Returns the ContentType of the data that will be written to the
service by this request or null if no data is written to the
server by the request.
Returns a stream that can be used to write request data to the GData service.
| IOException | error obtaining the request output stream. |
|---|
Returns the URL that is the target of the GData request
Returns the content type of the GData response.
null if no
response content.| IllegalStateException | attempt to read content type without first
calling execute(). |
|---|---|
| IOException | error obtaining the response content type. |
| ServiceException | error obtaining the response content type. |
Returns the value of a header containing a header or null if no
response header of this type exists or it could not be parsed as a valid
date.
| headerName | Name of header |
|---|
Returns the value of the specified response header name or null
if no response header of this type exists.
| headerName | Name of header |
|---|
Returns an input stream that can be used to read response data from the
GData service. Returns null if response data cannot be read as an input
stream. Use getParseSource() instead.
The caller is responsible for ensuring that the input stream is properly closed after the response has been read.
| IllegalStateException | attempt to read response without first
calling execute(). |
|---|---|
| IOException | error obtaining the response input stream. |
Sets the number of milliseconds to wait for a connection to the remote GData service before timing out.
| timeout | The read timeout. A value of zero indicates an infinite timeout. |
|---|
| IllegalArgumentException | if the timeout value is negative. |
|---|
Sets the entity tag value that will be used to conditionalize the request
if not null. For a query requests, the tag will cause the target
resource to be returned if the resource entity tag does not match
the specified value (i.e. if the resource has not changed). For update or
delete request types, the entity tag value is used to indicate that the
requested operation should occur only if the specified etag value does
match the specified value (i.e. if the resource has changed). A
request entity tag value may not be associated with other request types.
| etag |
|---|
Sets a request header (and logs it, if logging is enabled)
| name | The header name |
|---|---|
| value | The header value |
Sets the If-Modified-Since date precondition to be applied to the
request. If this precondition is set, then the request will be performed
only if the target resource has been modified since the specified date;
otherwise, a NotModifiedException will be thrown. The default
value is null, indicating no precondition.
| conditionDate | The date that should be used to limit the operation on the target resource. The operation will only be performed if the resource has been modified later than the specified date. |
|---|
Sets request header (and log just the name but not the value, if logging is enabled)
| name | The header name |
|---|---|
| value | The header value |
Sets the number of milliseconds to wait for a response from the remote GData service before timing out.
| timeout | The read timeout. A value of zero indicates an infinite timeout. |
|---|
| IllegalArgumentException | if the timeout value is negative. |
|---|