A - The type of the action.R - The type of the result.public abstract class AbstractCachingRpcInterceptor<A,R> extends AbstractRpcInterceptor<A,R>
Supported features include:
prefetch(A)/postfetch(A, R) perform the cache lookup and the cache store. You can use this
to customize the caching logic.
| Constructor and Description |
|---|
AbstractCachingRpcInterceptor(Class<A> actionType,
Cache cache) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canExecute(com.gwtplatform.dispatch.shared.TypedAction<?> action) |
com.gwtplatform.dispatch.shared.DispatchRequest |
execute(A action,
com.google.gwt.user.client.rpc.AsyncCallback<R> resultCallback,
ExecuteCommand<A,R> executeCommand) |
protected Cache |
getCache() |
protected abstract void |
postfetch(A action,
R result)
Override this method to perform an action after the call to the server returns successfully or not.
|
protected abstract R |
prefetch(A action)
Override this method to perform an action before the call is sent to the server.
|
com.gwtplatform.dispatch.shared.DispatchRequest |
undo(A action,
R result,
com.google.gwt.user.client.rpc.AsyncCallback<Void> callback,
UndoCommand<A,R> undoCommand)
Undoes the specified action if supported.
|
getActionTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetActionTypepublic com.gwtplatform.dispatch.shared.DispatchRequest execute(A action, com.google.gwt.user.client.rpc.AsyncCallback<R> resultCallback, ExecuteCommand<A,R> executeCommand)
public com.gwtplatform.dispatch.shared.DispatchRequest undo(A action, R result, com.google.gwt.user.client.rpc.AsyncCallback<Void> callback, UndoCommand<A,R> undoCommand)
RpcInterceptorDelegatingDispatchRequest.isPending() against the request parameter.action - The action to undo.result - The result to undo.callback - The callback to use to indicate when the action has been undone. Unless the request is
cancelled, you must invoke AsyncCallback.onSuccess(T) on this callback when you have
successfully undone the action. If any failure occurs call AsyncCallback.onFailure(java.lang.Throwable).undoCommand - Call UndoCommand.undo(Object, Object,
com.google.gwt.user.client.rpc.AsyncCallback) on this object to send the action over to
the server via gwt-rpc. As a parameter you can pass callback or your custom
AsyncCallback if you want to perform any processing following the undo.DispatchRequest object. Never return null, instead return a new
CompletedDispatchRequest if you executed,
cancelled or ignored the action.protected abstract R prefetch(A action)
null result then the action is never executed on the server and the returned value is used. If the
call returns null then the action is executed on the server.
You can use this method to fetch the action from the cache.action - The action to be prefetchednull.protected abstract void postfetch(A action, R result)
null will be passed in the result parameter.
You can use this method to add the result to cache, if it is null you should remove the action
from the cache.action - The action that just finished execution on the server.result - The result after the server call, or null if the server call failed.protected Cache getCache()
public boolean canExecute(com.gwtplatform.dispatch.shared.TypedAction<?> action)
canExecute in interface Interceptor<A,R>canExecute in class AbstractRpcInterceptor<A,R>Copyright © 2010–2017 Arcbees. All rights reserved.