org.qi4j.library.rest.client
Class RequestWriterDelegator

java.lang.Object
  extended by org.qi4j.library.rest.client.RequestWriterDelegator
All Implemented Interfaces:
Initializable, RequestWriter

public class RequestWriterDelegator
extends java.lang.Object
implements RequestWriter, Initializable

Delegates to a list of potential writers. Register writers on startup.


Constructor Summary
RequestWriterDelegator()
           
 
Method Summary
 void initialize()
          Initialize the fragment
 void registerRequestWriter(RequestWriter writer)
           
 boolean writeRequest(java.lang.Object requestObject, org.restlet.Request request)
          Write the given request object to the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestWriterDelegator

public RequestWriterDelegator()
Method Detail

initialize

public void initialize()
                throws InitializationException
Description copied from interface: Initializable
Initialize the fragment

Specified by:
initialize in interface Initializable
Throws:
InitializationException - if something went wrong

registerRequestWriter

public void registerRequestWriter(RequestWriter writer)

writeRequest

public boolean writeRequest(java.lang.Object requestObject,
                            org.restlet.Request request)
                     throws org.restlet.resource.ResourceException
Description copied from interface: RequestWriter
Write the given request object to the request.

Specified by:
writeRequest in interface RequestWriter
Parameters:
requestObject - The object to be written.
request - The Request destination of the requestObject
Returns:
true if the object was written to the Request instance, false if handler can not write the object.
Throws:
org.restlet.resource.ResourceException