org.lightwolf
Interface IRequest


public interface IRequest

An object that contains a request sent to a flow. Instances of this interface can be use to send a response for a given request.

Author:
Fernando Colombo
See Also:
Process.serve(Object)

Method Summary
 boolean needResponse()
          Tells whether the sender requires or not a response.
 Object request()
          The object that represents the request.
 void response(Object response)
          Sends the response, resuming the flow that is waiting for it.
 

Method Detail

needResponse

boolean needResponse()
Tells whether the sender requires or not a response. Whenever this method returns true, the sender is likely to be blocked, waiting for a response.


request

Object request()
The object that represents the request. This is the object passed with the message argument of methods such as Process.send(Object, Object) or Process.call(Object, Object).


response

void response(Object response)
Sends the response, resuming the flow that is waiting for it. This method can only be called when needResponse() is true, otherwise an exception is thrown. Once called, this method causes further invocations to needResponse() to return false.

Parameters:
response - The response to be sent to the flow that issued the request. This object will be the returned value of the ongoing Process.call(Object, Object).
Throws:
IllegalStateException - If there is no flow waiting for the response.