I was wondering how to control sessions using direct actions and WORedirect. Right now this is how my code looks ...

public WORedirect homeButton() {
        if (context().session() != null) {
                if (((Session)session()).authenticatedUser() != null) {
                        ((Session)session()).setAuthenticatedUser(null);
                        session().terminate();
                }
        }
String url = context().directActionURLForActionNamed("default", null);
        url = url.replaceAll("&", "&");
        WORedirect redirect = new WORedirect(context());
                redirect.setUrl(url);
        return redirect;

This works as long as the session being tested for null has not timed out. This bit of code is in a component at the top of every one of my pages. It controls what happens is a user is logged in. If that particular user in the session is logged in, I want them to automatically be logged out and sent to their intended destination where as here the destination is the home screen. The problem I am having is that when the session times out while the user is still logged in, the button takes them to the session timed out page.

What I want to do:
* When the WORedirect is called, I want the first if statement to test whether there is an active session. If there is, then I want to set the authenticated user to null, terminate the current session if there was a user authenticated, and then redirect them back to the default page. * If there is not an active session, I want to skip everything about the user, create a session, and redirect to the default page. * I don't ever want the user to see any kind of 'session timed out' page.

How could I go about doing this?


Thanks,
Awbrey
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to