编辑:我重新提出了问题
我正在使用Spring
and GWTEventService
(与 基本相同Comet
)。当我制作一个更简单的 HttpSessionListener 时,我看到sessionCreated() 被调用了两次,而 sessionDestroyed()没有被调用。这是为什么?一个用户有两个会话吗???第二个HttpSession
是在我第一次在会话 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");
}
}
示例输出:
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