com.flat502.rox.demo
Class AsyncClientDemo

java.lang.Object
  extended by com.flat502.rox.demo.AsyncClientDemo
All Implemented Interfaces:
AsynchronousResponseHandler

public class AsyncClientDemo
extends java.lang.Object
implements AsynchronousResponseHandler

A demo asynchronous client illustrating the HttpRpcClient.execute(String, Object[], Class, AsynchronousResponseHandler) method and the AsynchronousResponseHandler interface.


Constructor Summary
AsyncClientDemo()
           
 
Method Summary
 void handleException(RpcCall call, java.lang.Throwable e, RpcResponseContext context)
          This method is called for both local and remote exceptions.
 void handleResponse(RpcCall call, RpcResponse response, RpcResponseContext context)
          This method is called when a successful response is received from the server.
static void main(java.lang.String[] args)
          Call each of the exposed methods on the remote demo server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncClientDemo

public AsyncClientDemo()
Method Detail

handleResponse

public void handleResponse(RpcCall call,
                           RpcResponse response,
                           RpcResponseContext context)
Description copied from interface: AsynchronousResponseHandler
This method is called when a successful response is received from the server.

A successful response is defined as one that contains a return value that is not an RPC fault.

Specified by:
handleResponse in interface AsynchronousResponseHandler
Parameters:
call - The original method call that this response applies to.
response - The response to the method call.

handleException

public void handleException(RpcCall call,
                            java.lang.Throwable e,
                            RpcResponseContext context)
Description copied from interface: AsynchronousResponseHandler
This method is called for both local and remote exceptions.

A local exception is one that is raised within this JVM as a result of a failure while handling either the request or response. This may be an instance of any sub-class of Throwable other than RpcFaultException.

A remote exception is always an instance of RpcFaultException wrapping an RPC fault response.

Specified by:
handleException in interface AsynchronousResponseHandler
Parameters:
call - The original method call that this response applies to.
e - An instance of RpcFaultException for a remote exception. For a local exception any other exception type.

main

public static void main(java.lang.String[] args)
Call each of the exposed methods on the remote demo server.

Parameters:
args - A list of parameters. Only the first is used and if present must be the URL of the remote server. This defaults to http://localhost:8080/ if not specified.