• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Controlling Sessions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Controlling Sessions


  • Subject: Re: Controlling Sessions
  • From: David LeBer <email@hidden>
  • Date: Mon, 17 Nov 2008 18:09:00 -0500


On 17-Nov-08, at 5:49 PM, Awbrey Hughlett wrote:

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("&amp;", "&");
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?

Why don't you get rid of the redirect change the link on the page to call a da directly and put that logic into the directAction?


;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: 	http://codeferous.com
blog: 	http://davidleber.net
profile:	http://www.linkedin.com/in/davidleber
twitter:	http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org




_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Controlling Sessions
      • From: Awbrey Hughlett <email@hidden>
References: 
 >Controlling Sessions (From: Awbrey Hughlett <email@hidden>)

  • Prev by Date: Controlling Sessions
  • Next by Date: Re: Controlling Sessions
  • Previous by thread: Controlling Sessions
  • Next by thread: Re: Controlling Sessions
  • Index(es):
    • Date
    • Thread