net.degreedays.api.processing
Class XmlHttpRequestProcessor

java.lang.Object
  extended by net.degreedays.api.processing.XmlHttpRequestProcessor
All Implemented Interfaces:
RequestProcessor

public final class XmlHttpRequestProcessor
extends java.lang.Object
implements RequestProcessor

A concrete implementation of the RequestProcessor interface that turns Request objects into XML, adds the necessary security details, sends them over HTTP to the Degree Days.net API servers, and parses the XML responses into Response object models.

To create an instance of this class, you'll need to use the XmlHttpRequestProcessor.Builder class. Using a Builder you can heavily customize the way in which the created XmlHttpRequestProcessor works. For example, a default XmlHttpRequestProcessor uses java.net classes to manage connections to the API servers, but you might want to swap in HttpClient-based functionality if the rest of your application uses HttpClient.

For more on the customization options, see the docs for the XmlHttpRequestProcessor.Builder.

This class is designed to be safe for use in a multi-threaded environment. However, if you create a customized instance of this class, then the thread-safety of its operation will depend on the thread-safety of any custom processing components that you introduce.


Nested Class Summary
static class XmlHttpRequestProcessor.Builder
          Builds XmlHttpRequestProcessor objects: create and configure a Builder object, then call XmlHttpRequestProcessor.Builder.build() to create an XmlHttpRequestProcessor object.
 
Method Summary
 Response process(Request request)
          Processes the Request object and returns a Response object which is either a FailureResponse or a Response that's type is the counterpart to that of the Request object passed in.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

process

public Response process(Request request)
                 throws TransportException
Description copied from interface: RequestProcessor
Processes the Request object and returns a Response object which is either a FailureResponse or a Response that's type is the counterpart to that of the Request object passed in.

For example, successful processing of a LocationDataRequest will result in a LocationDataResponse.

Specified by:
process in interface RequestProcessor
Parameters:
request - the Request to be processed. Cannot be null.
Returns:
a Response object which is either a FailureResponse or a Response that's type is is the counterpart to that of the Request passed in.
Throws:
TransportException - if there is a network- or stream-related error.


www.degreedays.net/api/