0

Edit: I reformulated the question

I'm using Spring and GWTEventService (which is basicly the same as Comet). When I make a simpler HttpSessionListener, I see sessionCreated() is called twice and sessionDestroyed() is not called in between. Why is that? Do I have two sessions for one user??? The second HttpSession is created when I set some information for the first time at a session bean (Spring).

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
 
public class SomeSessionListener implements HttpSessionListener {
 
  @Override
  public void sessionCreated(HttpSessionEvent se) {
    log.info("New session was created, source= " + se.getSource());
  }
 
  @Override
  public void sessionDestroyed(HttpSessionEvent se) {
    log.info("A session was closed");
  } 
}

Example Output:

Application has started
New session was created, source= org.mortbay.jetty.servlet.HashSessionManager$Session:21u4n0rnyp4i@24662444
New session was created, source= org.mortbay.jetty.servlet.HashSessionManager$Session:n9wm8tsj1ote@28925695
Application interrupted by client
Community
  • 1
  • 1
Vjeetje
  • 5,314
  • 5
  • 35
  • 57

1 Answers1

0

I found the answer formulated to a different question: Spring security concurrent-session and HttpSessionListener problem

In short: It's better to a destroy-method to the session bean.

Community
  • 1
  • 1
Vjeetje
  • 5,314
  • 5
  • 35
  • 57