com.flat502.rox.server
Interface ResponseChannel


public interface ResponseChannel

An interface for delivering asynchronous RPC method responses.

An instance of this is passed to the AsynchronousRequestHandler.handleRequest(RpcCall, RpcCallContext, ResponseChannel) method. When a response is available it may be sent using this class. This makes it possible to hand work off to application threads, leaving the calling thread to return to the task of handling HTTP responses.


Method Summary
 void close()
          Close the channel on which the original RPC method call was received.
 void respond(HttpResponseException e)
          Deliver an HTTP error response to a remote caller.
 void respond(RpcResponse rsp)
          Deliver an RPC method response to a remote caller.
 

Method Detail

respond

void respond(RpcResponse rsp)
             throws java.io.IOException,
                    MarshallingException
Deliver an RPC method response to a remote caller.

Parameters:
rsp - The response to marshal and send back.
Throws:
java.io.IOException - An exception may be raised while attempting to send the response to the client.
MarshallingException

respond

void respond(HttpResponseException e)
             throws java.io.IOException
Deliver an HTTP error response to a remote caller.

Parameters:
e - The response to marshal and send back.
Throws:
java.io.IOException - An exception may be raised while attempting to send the response to the client.

close

void close()
           throws java.io.IOException
Close the channel on which the original RPC method call was received.

Implementations are not required to close this channel under normal operations. Typically closing this channel is only required when an error occurs that may corrupt this channel's state.

Throws:
java.io.IOException - An exception may be raised while attempting to close the underlying channel.