aspose file tools*
The moose likes Servlets and the fly likes Invalidate Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Invalidate Question" Watch "Invalidate Question" New topic
Author

Invalidate Question

Gus Mus
Ranch Hand

Joined: Feb 28, 2003
Posts: 53
Is there any way to know if the session is invalidated or not ?
Arron Zhang
Greenhorn

Joined: Dec 27, 2002
Posts: 15
package arron;
import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;
public class SessionCount implements HttpSessionListener {

private static int activeSessions = 0;
public static int getActiveSessions() {
return activeSessions;
}
public void sessionCreated(HttpSessionEvent e) {
activeSessions++;
}

public void sessionDestroyed(HttpSessionEvent e) {
if(activeSessions > 0) activeSessions--;
}
}


novelist & programmer
Geeta Ramasami
Ranch Hand

Joined: Mar 05, 2003
Posts: 72
Hi,
For this u can implement the HttpSessionBindingListener Interface.There u have 2 methods valueBound and valueUnBound.
When a session is invalidated the valueUnBound is called inside which u can write some logic to hold the identification of the session invalidation.
Geeta
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalidate Question
 
Similar Threads
child object and parent object... assignable?
Ending a session?
How to delete a session by knowing the session id
Fake landing on the moon???
Releasing HTTP session state