public interface RequestProcessor
You might not want to use this interface directly, since
DegreeDaysApi provides a much more usable interface. But all the API
requests that you make through a DegreeDaysApi object will be
processed internally by a RequestProcessor. However you use the
API, an implementation of this interface will be doing all the work of
sending requests to the API servers and getting responses back.
RequestProcessor for testing
You might want to make or use a mock implementation of this interface for
testing your application. Such a mock implementation only needs to work for
the types of Request that your application makes (it doesn't
necessarily need to be able to handle all types of Request).
If you create a DegreeDaysApi object with a mock implementation of
RequestProcessor, then all the requests you make though that
DegreeDaysApi object will be processed by your mock
RequestProcessor.
By default this client library uses a default instance of
XmlHttpRequestProcessor - that's what
DegreeDaysApi will create and use internally if you don't give it a
specific RequestProcessor to use. In most cases the defaults are
ideal. But you can easily customize the processing that the
XmlHttpRequestProcessor does. You might, for example, want to
change the endpoint URL, or swap the default java.net-based
HttpRequestDispatcher for one that uses
HttpClient instead (if your app uses HttpClient elsewhere). See the
XmlHttpRequestProcessor docs for more on how to do this sort of
thing.
| Modifier and Type | Method and Description |
|---|---|
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. |
Response process(Request request) throws TransportException
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.
request - the Request to be processed. Cannot be
null.Response object which is either a
FailureResponse or a
Response that's type is is the
counterpart to that of the Request passed in.TransportException - if there is a network- or stream-related
error.java.lang.NullPointerException - if request is null.
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.