de.fhhannover.inform.trust.ifmapj.messages
Interface RequestHandler<T extends Request>


public interface RequestHandler<T extends Request>

Provides functionality to generically handle Request instances and response parsing.

Since:
0.1.4
Author:
aw

Method Summary
 Result fromElement(Element response)
          Unmarshals a given response in XML form to a Result instance.
 Class<T> handles()
           
 Element toElement(Request req, Document doc)
           
 

Method Detail

toElement

Element toElement(Request req,
                  Document doc)
                  throws MarshalException
Throws:
MarshalException

fromElement

Result fromElement(Element response)
                   throws UnmarshalException,
                          IfmapErrorResult
Unmarshals a given response in XML form to a Result instance. The given Element instance is the ifmap:response element. It might have an errorResult element attached. An implementation has to check for this condition and throw an appropriate IfmapErrorResult.

Parameters:
response - the Element under
Returns:
an appropriate Result implementation or null if there is no real result, but everything was good.
Throws:
UnmarshalException
{@link - IfmapErrorResult} if an errorResult was found
IfmapErrorResult
See Also:
Requests.Helpers#getResponseContentErrorCheck(Element)}.

handles

Class<T> handles()
Returns:
the Class object associated with the Request instance this RequestHandler is able to cope with.


Copyright © 2012 Trust@FHH. All Rights Reserved.