A
- The type of the TypedAction
wrapped by this DispatchCall
.R
- The type of the result of the wrapped TypedAction
.public abstract class DispatchCall<A extends TypedAction<R>,R> extends Object
RestDispatch
or
DispatchAsync
.
This class will perform the work shared by all dispatch modules. It will delegate exceptions to the bound
ExceptionHandler
. It will provide access to the security cookie through the bound
SecurityCookieAccessor
. It will also delegate calls to the bound ClientActionHandlerRegistry
.
It also provides a couple extension points for implementations.Constructor and Description |
---|
DispatchCall(ExceptionHandler exceptionHandler,
ClientActionHandlerRegistry clientActionHandlerRegistry,
SecurityCookieAccessor securityCookieAccessor,
DispatchHooks dispatchHooks,
A action,
AsyncCallback<R> callback) |
Modifier and Type | Method and Description |
---|---|
protected abstract DispatchRequest |
doExecute()
Implementations must override this method to perform additional work when
execute() is called. |
DispatchRequest |
execute()
Call this method to execute the
action wrapped by this instance. |
protected A |
getAction()
Returns the
TypedAction wrapped by this DispatchCall . |
protected AsyncCallback<R> |
getCallback()
The
AsyncCallback to use when the execution of the action wrapped by this object is completed. |
protected ClientActionHandlerRegistry |
getClientActionHandlerRegistry()
Returns the bound
ClientActionHandlerRegistry . |
protected ExceptionHandler |
getExceptionHandler()
Returns the bound
ExceptionHandler . |
protected String |
getSecurityCookie()
Returns the current security cookie as returned by the bound
SecurityCookieAccessor . |
protected SecurityCookieAccessor |
getSecurityCookieAccessor()
Returns the bound
SecurityCookieAccessor . |
protected void |
onExecuteFailure(Throwable caught)
Override this method to perform additional work when the action execution failed.
|
protected void |
onExecuteFailure(Throwable caught,
Response response)
Override this method to perform additional work when the action execution failed.
|
protected void |
onExecuteSuccess(R result)
Override this method to perform additional work when the action execution succeeded.
|
protected void |
onExecuteSuccess(R result,
Response response)
Override this method to perform additional work when the action execution succeeded.
|
public DispatchCall(ExceptionHandler exceptionHandler, ClientActionHandlerRegistry clientActionHandlerRegistry, SecurityCookieAccessor securityCookieAccessor, DispatchHooks dispatchHooks, A action, AsyncCallback<R> callback)
public DispatchRequest execute()
action
wrapped by this instance. If the action is registered
by the ClientActionHandlerRegistry
, it will delegate the call it.
Implementations should consider overriding doExecute()
to perform additional work.DispatchRequest
object.protected abstract DispatchRequest doExecute()
execute()
is called.DispatchRequest
object.protected A getAction()
TypedAction
wrapped by this DispatchCall
.TypedAction
wrapped by this object.protected AsyncCallback<R> getCallback()
AsyncCallback
to use when the execution of the action wrapped by this object is completed.AsyncCallback
to call when the action has been executed.protected ClientActionHandlerRegistry getClientActionHandlerRegistry()
ClientActionHandlerRegistry
.ClientActionHandlerRegistry
.protected ExceptionHandler getExceptionHandler()
ExceptionHandler
.ExceptionHandler
.protected SecurityCookieAccessor getSecurityCookieAccessor()
SecurityCookieAccessor
.SecurityCookieAccessor
.protected String getSecurityCookie()
SecurityCookieAccessor
.protected void onExecuteSuccess(R result)
result
- the action result.protected void onExecuteSuccess(R result, Response response)
result
- the action result.response
- the action Response
.protected void onExecuteFailure(Throwable caught)
caught
- the caught Throwable
.Copyright © 2010–2014 Arcbees. All rights reserved.