【发布时间】:2014-10-27 14:49:30
【问题描述】:
我的 Java Web 应用程序(tomcat8,servlet3)中有一个 entity 类的 List<entity> ctx,我为每个会话(用户)保留一个实例和我的上下文(列表),并在用户会话中保留一个参考副本,比如关注。
javax.servlet.http.HttpSession sess=request.getSession(true);
//declaring and initializing the entity object
entity e=new entity();
e.timestamp=System.currentTimeMillis();
//keep the e with the session
sess.setAttribute("e",e);
//and a reference copy with another context
ctx.add(e);
问题:
我只想知道(一个事件,监听器,...)关于用户 http 会话,以便在会话过期(删除)时从 ctx 中删除 entity 对象。
现在我怎么能意识到会话正在从服务器过期?
【问题讨论】:
标签: java session tomcat servlets web