@Override public DispatchRequest execute(A action, AsyncCallback<R> resultCallback) { if (dispatchRequest.isPending()) { return dispatchCall.processCall(); } else { return null; } }
@Override public void onFailure(Throwable caught) { dispatchRequest.cancel(); dispatchCall.onExecuteFailure(caught); }
/** * Override this method to perform additional work when the action execution succeeded. * * @param result the action result. * @param response the action {@link Response}. */ protected void onExecuteSuccess(R result, Response response) { onExecuteSuccess(result); }
@Override public void onSuccess(T interceptor) { if (!interceptor.canExecute(getAction())) { delegateFailure(interceptor); } else if (getDispatchRequest().isPending()) { delegateExecute(interceptor); } }
@SuppressWarnings("unchecked") @Override public void onSuccess(ClientActionHandler<?, ?> clientActionHandler) { if (clientActionHandler.getActionType() != action.getClass()) { delegateFailure(clientActionHandler); } else if (dispatchRequest.isPending()) { delegateExecute((ClientActionHandler<A, R>) clientActionHandler); } }
@SuppressWarnings({"unchecked"}) protected <R> void execute(RestAction<R> action) { DispatchRequest dispatchRequest = dispatcher.execute(action, (AsyncCallback<R>) callback); if (delegatingDispatchRequest != null) { delegatingDispatchRequest.setDelegate(dispatchRequest); } }
protected <A extends Action<R>, R extends Result> void onUndoFailure(A action, Throwable caught, final AsyncCallback<Void> callback) { if (getExceptionHandler() != null && getExceptionHandler().onFailure(caught) == ExceptionHandler.Status.STOP) { return; } callback.onFailure(caught); }
@Override public void onFailure(Throwable caught) { dispatchRequest.cancel(); callback.onFailure(caught); } });
@Override protected <A extends Action<R>, R extends Result> DispatchRequest doUndo( String securityCookie, final A action, final R result, final AsyncCallback<Void> callback) { return new GwtHttpDispatchRequest(realService.undo(securityCookie, action, result, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { RpcDispatchAsync.this.onUndoFailure(action, caught, callback); } public void onSuccess(Void voidResult) { RpcDispatchAsync.this.onUndoSuccess(action, voidResult, callback); } })); }
/** * Override this method to perform additional work when the action execution failed. * * @param caught the caught {@link Throwable}. */ protected void onExecuteFailure(Throwable caught) { if (exceptionHandler != null && exceptionHandler.onFailure(caught) == Status.STOP) { return; } callback.onFailure(caught); }
private <R> ExecuteCommand<RestAction<R>, RestCallback<R>> wrapCommand( ExecuteCommand<RestAction<R>, RestCallback<R>> command) { return (newAction, newCallback) -> { onExecute(newAction); RestCallback<R> callbackWrapper = wrapCallback(newAction); return command.execute(newAction, callbackWrapper); }; }
/** * Override this method to perform additional work when the action execution failed. * * @param caught the caught {@link Throwable}. * @param response the failure {@link Response}. */ protected void onExecuteFailure(Throwable caught, Response response) { onExecuteFailure(caught); } }
@SuppressWarnings("unchecked") public void onSuccess(Result result) { // Note: This cast is a dodgy hack to get around a GWT // 1.6 async compiler issue RpcDispatchAsync.this.onExecuteSuccess(action, (R) result, callback); } }));
public void onSuccess(Void voidResult) { RpcDispatchAsync.this.onUndoSuccess(action, voidResult, callback); } }));
public void onFailure(Throwable caught) { RpcDispatchAsync.this.onExecuteFailure(action, caught, callback); }
public void onFailure(Throwable caught) { RpcDispatchAsync.this.onUndoFailure(action, caught, callback); }
@Override protected <A extends Action<R>, R extends Result> void prepareUndo(A action) { prepareService((ServiceDefTarget) realService, baseUrl, action.getServiceName()); } }
@Override public void onFailure(Throwable caught) { dispatchRequest.cancel(); dispatchCall.onExecuteFailure(caught); }
protected <A extends Action<R>, R extends Result> void onExecuteFailure(A action, Throwable caught, final AsyncCallback<R> callback) { if (getExceptionHandler() != null && getExceptionHandler().onFailure(caught) == ExceptionHandler.Status.STOP) { return; } callback.onFailure(caught); }
@Override public void onFailure(Throwable caught) { dispatchRequest.cancel(); callback.onFailure(caught); } });