Re: How to resubmit RPC after session timeout/login
On Feb 5, 10:24 pm, Jamie <jsgreenb...@gmail.com> 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/GoogleWebToolkitBestPractices.html
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home