• 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: WOA, Building a Login form
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOA, Building a Login form


  • Subject: Re: WOA, Building a Login form
  • From: Drew Thoeni <email@hidden>
  • Date: Sun, 3 Apr 2005 18:32:59 -0400


On Apr 3, 2005, at 6:20 PM, Ondra Cada wrote:

Drew,

On 3.4.2005, at 23:58, Drew Thoeni wrote:

I have an object in the session called currentUser. I set this to the user fetched from the database (see snipit below). On logout, I nullify that object. Again, there may be a better way.

There is... in a sense. Since the more complicated the application, the more probable the session may contain some user's important data, it's better to kill the session instead.


Myself, I tend to use something like this (with the very same disclaimer: there may be much better way still :))

	public WOComponent logout() {
		session().terminate();
		WORedirect wor=new WORedirect(context());
		wor.setUrl(context().directActionURLForActionNamed("default",null));
		return wor;
	}


Yes. I agree. Oddly, I had not thought about this, but I am both nullifying the session.user and terminating the session. Upon reflection, I suppose I can just do the latter.



And, I have an outstanding question to myself whether this is just making a reference, or really copying the data.

Uh-oh? *All* Java objects are references, if that's what we are speaking of. To copy one, you have to do that manually (like by using the clone method).

That seemed to be the case and you and Sacha point this out. My concern, on this question is exhibited in this snippet:


Object a = new Object(); // assume values populated after instanation
Object b = new Object(); // assume empty
b = a; // assume a is garbage collected because it was build inside a method


So, the question is, when "a" goes away does "b" become null?

Drew



---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc


_______________________________________________ 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: WOA, Building a Login form
      • From: Ondra Cada <email@hidden>
References: 
 >WOA, Building a Login form (From: Amedeo Mantica <email@hidden>)
 >Re: WOA, Building a Login form (From: Drew Thoeni <email@hidden>)
 >Re: WOA, Building a Login form (From: Amedeo Mantica <email@hidden>)
 >Re: WOA, Building a Login form (From: Drew Thoeni <email@hidden>)
 >Re: WOA, Building a Login form (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: WOA, Building a Login form
  • Next by Date: Create&initialize a session programmatically?
  • Previous by thread: Re: WOA, Building a Login form
  • Next by thread: Re: WOA, Building a Login form
  • Index(es):
    • Date
    • Thread