aspose file tools*
The moose likes JSP and the fly likes Session Invalidation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Session Invalidation" Watch "Session Invalidation" New topic
Author

Session Invalidation

Krishna, Alle
Greenhorn

Joined: Nov 16, 2001
Posts: 14
Hi All,
I wanted to know when a session is invalidated with a HttpSession.invalidate() call, is the session object destroyed or are all the objects associated with the session are destroyed?
Snippet of the code I have in a JSP,
String inv = request.getParameter("action");
if(inv != null && inv.equals("invalidate")) {
session = request.getSession(true);
session.invalidate();
}
System.out.println("SESS = " + session);
String sessionAttr1 = (String)session.getAttribute("uid");
I get an IllegalStateException when the getAttibute method in the above piece of code is executed. But, I can see the print statement SESS shows a session.
FYI: I am using Orion Application Server, ver 1.5.2
Can someone let me know the answer. I appreciate the response in advance. Let me know if the question is ambiguous.
Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
I believe it works this way. When you call session.invalidate, the system detaches all items attached to the session object and marks it as an invalid session. Subsequently all session method calls then throw that exception. The servlet engine can't null out all references to the session until after the current request/response cycle is finished so the object is still there.
Bill
Krishna, Alle
Greenhorn

Joined: Nov 16, 2001
Posts: 14
Bill,
Thank you for the information. So is this some kind of limitation the Session Management API.
Once again, Thanks
Vasanth
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Krishna
to be on safe side i'd have written,

regards
maulin
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Session Invalidation