• 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: [Noobie] Making one action available to all WOComponents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Noobie] Making one action available to all WOComponents


  • Subject: Re: [Noobie] Making one action available to all WOComponents
  • From: Mark Ritchie <email@hidden>
  • Date: Mon, 25 Dec 2006 02:09:01 -0500

On 23-Dec-06, at 5:31 PM, email@hidden wrote:
I would like to provide a "logout" button on just about every html- page that i render in my WO-Application which would set some session variables back to null and redirect the user to the 'Main' page.
However i'm failing at finding the right spot ...

Hi Malte!

I'd suggest writing something like the following in your Session.java:

public WOComponent logout() {
// arrange for this session to terminate at the end of the Request/ Response loop
terminate();


// return a page to confirm that we're logged out
// note: make sure that LoggedOutPage doesn't have component action links
// use direct actions with ?wosid = false binding
Application application = (Application)WOApplication.application();
return application.pageWithName("LoggedOutPage", context());
}


This code arranges to terminate the current session and sends to user to a page which confirms that they've logged out. You can create hyperlink which invokes this action directly or as Miguel mentioned, you can create a custom logout component which calls this method.

Since you're terminating the session, there's really no need to clear any session variables. They will go away when garbage collection gets around to cleaning up the instance. (Yes, yes, you can null them if you want to. :-)

Finally, a note about the LoggedOutPage! I like to give users a confirmation that they've terminated their session. That's why I send them to a page which says their session is terminated. I also like that page to have a link back to the main/login page of the app however I DON'T want a session hanging around. That means that the LoggedOutPage needs to have direct actions only. That way, when the user logs out, the session count of the application actually goes down. (Your sysadmins will appreciate this design when they look at the session count when trying to decide if any users are actually using your application!!)

I hope that's clear!
Good luck!
Mark
__
Mark Ritchie
Diamond Lake Consulting Inc.
Toronto Ontario Canada



_______________________________________________
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: [Noobie] Making one action available to all WOComponents
      • From: "Malte Philipp A." <email@hidden>
References: 
 >[Noobie] Making one action available to all WOComponents (From: email@hidden)

  • Prev by Date: Re: XCode and debugging - Ugly workaround found.
  • Next by Date: EOOrQualifier generated from an array
  • Previous by thread: Re: [Noobie] Making one action available to all WOComponents
  • Next by thread: Re: [Noobie] Making one action available to all WOComponents
  • Index(es):
    • Date
    • Thread