I think I've found a good way to handle this. It really is pretty
easy.
I subclassed PlaceController and override it goTo() method. It looks
like this:
public void goTo( Place newPlace )
{
if( isLoggedIn )
super.goTo( newPlace );
else
super.goTo( new LoginPlace() );
}
It seems to work well. Handles pages that are bookmarked and the back
button.
On Nov 12, 5:43 pm, Mike Dee <[email protected]> wrote:
> What is a good way to have a GWT app redirect to a login screen when a
> session expires? I've just hooked up a login page and a logout button
> at an Activities and Places app. I basically handle this through the
> event bus with login and logout events (haven't hooked up a session
> time out yet).
>
> The events work nicely. After logging in, the main place appears in
> the app. When logging on, the login place appears. Very nice.
>
> However, nothing prevents a user from accessing a place within the app
> - either by bookmarking or using the back button after logging out.
> I've experimented with a few things, but don't like any of them. For
> example, in the AppActivityMapper if the user is not logged in, it
> goes to the login place regardless of the requested place. I don't
> like this because the URL still shows the requested place.
>
> It looks like a central place to handle this is in
> PlaceController.goTo(). While looking at the source, it appears that
> changing places is handled via the event bus.
>
> String warning = maybeGoTo(newPlace);
> if (warning == null || delegate.confirm(warning)) {
> where = newPlace;
> eventBus.fireEvent(new PlaceChangeEvent(newPlace));
>
> Has anyone tried overriding this to handle loggin/logout?
--
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.