Class Handler<T>

  • Type Parameters:
    T - type of result for AsyncCallback.onSuccess(Object) if the operation completed successfully.
    All Implemented Interfaces:
    Callable<T>
    Direct Known Subclasses:
    ProjectAccessHandler

    public abstract class Handler<T>
    extends Object
    implements Callable<T>
    Base class for RPC service implementations.

    Typically an RPC service implementation will extend this class and use Guice injection to manage its state. For example:

       class Foo extends Handler<Result> {
         interface Factory {
           Foo create(... args ...);
         }
         @Inject
         Foo(state, @Assisted args) { ... }
         Result get() throws Exception { ... }
       }
     
    • Constructor Detail

      • Handler

        public Handler()
    • Method Detail

      • to

        public final void to​(com.google.gwtjsonrpc.common.AsyncCallback<T> callback)
        Run the operation and pass the result to the callback.
        Parameters:
        callback - callback to receive the result of call().
      • call

        public abstract T call()
                        throws Exception
        Compute the operation result.
        Specified by:
        call in interface Callable<T>
        Returns:
        the result of the operation. Return VoidResult.INSTANCE if there is no meaningful return value for the operation.
        Throws:
        Exception - the operation failed. The caller will log the exception and the stack trace, if it is worth logging on the server side.