@SuppressWarnings("unchecked") private <A extends Action<R>, R extends Result> DispatchRequest serviceExecute( A action, AsyncCallback<R> callback) { boolean fail = false; R result = null; try { result = (R) service.execute("", action); } catch (Throwable caught) { fail = true; callback.onFailure(caught); } if (!fail) { callback.onSuccess(result); } return new CompletedDispatchRequest(); }
@SuppressWarnings("unchecked") private <A extends Action<R>, R extends Result> DispatchRequest serviceUndo(A action, R result, AsyncCallback<Void> callback) { boolean fail = false; try { service.undo("", (Action<Result>) action, result); } catch (Throwable caught) { fail = true; callback.onFailure(caught); } if (!fail) { callback.onSuccess(null); } return new CompletedDispatchRequest(); } }
return new CompletedDispatchRequest(); } else {
return new CompletedDispatchRequest(); } else {
return new CompletedDispatchRequest(); } else {
/** * Execution entry point. Call this method to execute the {@link RestAction action} wrapped by this instance. * * @return a {@link DispatchRequest} object. */ public DispatchRequest execute() { try { RequestBuilder requestBuilder = createRequest(); cookieManager.saveCookiesFromAction(action); return new GwtHttpDispatchRequest(requestBuilder.send()); } catch (RequestException | ActionException e) { callback.onFailure(e); } return new CompletedDispatchRequest(); }