Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpSession timeout does not trigger an HttpSessionBindingEvent  RSS feed

 
Jason Lin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using session binding to track active user sessions.
It works fine when the user logs out and session.invalidate()
is called explicitly which causes the unbinding event, but when the session times out the bind event is not called?
Let me know if anyone knows why the timeout doesn't cause the sesison to be invalidated??
regards,
Jason
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It has worked when I tried it. What does your HttpSessionBindingListener implementation look like and how do you attach it to sessions?
Bill
 
Jason Lin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the partial list of my binding listener:
public class SessionMonitor
extends UserSessionTracker
implements HttpSessionBindingListener
{
private SessionMonitor(Connection conn)
throws UserSessionException {
super(conn);
}
public static final SessionMonitor getInstance()
throws UserSessionException {
try {
if (null == instance)
instance = new SessionMonitor(SingletonPool.getConnectionPool().getConnection());
} catch (SQLException e) {
throw new UserSessionException(e.getMessage());
}
return instance;
}
/**
* The single instance of SessionMonitor
*/
private static SessionMonitor instance;
public void valueUnbound(HttpSessionBindingEvent event) {
try {
updateSession(event.getSession().getId());
} catch (UserSessionException e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
...
// binding to the session after login
SessionMonitor sm = SessionMonitor.getInstance();
session.setAttribute("sessionMonitor", sm);
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That certainly looks like it should work, as indicated by the fact that specifically calling invalidate works. I guess the next question is, are you using the default timeout setting for sessions?
Bill
 
Jason Lin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have tried using default timeout (30min) and also tried set it to 100 sec so I don't have to wait for long before it times out.
Could it be something in the iPlanet configuration that needs to be set???
thanks,
Jason
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!