How do redirect to another page in GWT?

On 27 abr, 06:29, Sripathi Krishnan <sripathikrish...@gmail.com>
wrote:
> Just have a custom class the extends AsyncCallback, like below, and mandate
> that everybody uses it instead of directly using AsyncCallback.
>
> public abstract class MyAsyncCallback<T> implements AsyncCallback<T> {
>
>       public void onFailure(Throwable caught) {
>               if(caught instanceof AuthenticationException) {
>                     //redirect to login page
>               }
>               else if(caught instanceof AuthorizationException) {
>                     //tell the user he doesn't have rights to perform this
> operation
>               }
>
>               try {
>                       //allow your application to handle the exception
>                       handleFailure(caught);
>               }
>               catch(Throwable e) {
>                      //default application-wide error handling
>               }
>       }
>
>       //provide a default implementation. Code that wants to handle
> exceptions can do so by overriding this method
>       //Lazy developers can just ignore it, and the app-wide error handling
> framework will do the needful
>       public void handleFailure(Throwable t) throws Exception {
>              throw t;
>       }
>
> }
>
> --Sri
>
> On 27 April 2010 12:38, StrongSteve <swe.sta...@gmail.com> wrote:
>
>
>
> > Thanks for your quick reply.
>
> > I am just wondering if there is no easier way to do this.
>
> > I mean, adding an exception to all server methods and checking it in
> > every onFailure block does not seem so pratical to me.
>
> > There should be an easier way!
>
> > Thanks in Advance!
> > Stefan
>
> > On Apr 26, 5:08 pm, kozura <koz...@gmail.com> wrote:
> > > Easiest is probably to just create an exception for session timeout,
> > > and throw it on the server side after you check for session validity.
> > > Then put a standard method in your onFailure call to popup the error
> > > when that exception is received.
>
> > > On Apr 26, 8:25 am,StrongSteve<swe.sta...@gmail.com> wrote:
>
> > > > Hi Everbody,
>
> > > > I am looking for a way to implement a session timeout behaviour into
> > > > my GWT application.
>
> > > > On the ServerSide I have a session listener that sets the value for
> > > > the session timeout as soon as a new session is being created.
>
> > > > Now what I would like to do is to present the user a popup as soon as
> > > > the session has experied.
> > > > This does not have to happen automatically. It is also ok to show this
> > > > popup as soon as a new request is addressed against the server.
>
> > > > Now I am looking for some best practices on how to deal with this
> > > > problem.
> > > > I believe some of you have already dealt with similar problem! ;)
>
> > > > Thanks in Advance for your help!
>
> > > > Greetings
> > > > Stefan
>
> > > --
> > > 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+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> > .
> > > For more options, visit this group athttp://
> > groups.google.com/group/google-web-toolkit?hl=en.
>
> > --
> > 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-tool...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> 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-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to