Can you give me an example on how I'd be able to resubmit an RPC with Ray's command pattern approach?
On Feb 6, 5:50 am, Thomas Broyer <[email protected]> wrote: > On Feb 5, 10:24 pm, Jamie <[email protected]> wrote: > > > > > > > Hi everybody. I'm trying to extend AsyncCallback to always have the > > same behavior onFailure. I can successfully catch the session timeout > > exception that I'm looking for, open a login dialog, and have the user > > login. What I want to do after that is done is to resubmit the > > original RPC call that caused the onfailure. Here's what I have so > > far: > > > <code> > > public abstract class MyAsyncCallback<T> implements AsyncCallback<T> { > > > public final void onFailure(Throwable caught) { > > if(caught instanceof StatusCodeException && > > ((StatusCodeException)caught).getStatusCode() == 401) { > > final LoginDialog login = new LoginDialog(); > > login.addLoginDialogListener(new > > LoginDialogListener() { > > public void loginSuccess() { > > login.hide(); > > //RESUBMIT THE ORIGINAL RPC HERE > > } > > }); > > } else { > > Window.alert("An error has occurred. Contact your > > system > > administrator."); > > } > > } > > > public final void onSuccess(T result) { > > uponSuccess(result); > > } > > > public abstract void uponSuccess(T result); > > > } > > > </code> > > > Does anybody know how I can capture the original RPC before it is sent > > so I can resubmit it? > > I suppose Ray Ryan's proposal to use a command pattern for your RPC > calls [1] would help you in solving it. > > [1]http://code.google.com/events/io/2009/sessions/GoogleWebToolkitBestPr... -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
