Re: WOA, Building a Login form
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