【发布时间】:2012-02-08 18:43:21
【问题描述】:
我正在编写我的第一个 GWT 应用程序,并且正在实施会话。
目前我正在生成一个
HttpServletRequest request = getThreadLocalRequest();
HttpSession httpSession = request.getSession(true);
httpSession.setMaxInactiveInterval(1000 * 60 * 2);//2min
然后在显示任何屏幕之前通过对服务器的 RPC 调用验证会话是否与用户相同
HttpServletRequest request = getThreadLocalRequest();
HttpSession httpSession = request.getSession(false);
if(user.getSessionId().equals(result.getSessionId()))
//display screen
我的问题是关于 setMaxInactiveInterval();非活动超时似乎根本不适合我 - 两分钟后会话不会自行到期
我的方法正确吗?谢谢。
附言我用这个作为跳出:http://snipt.net/javagner/session-in-gwt/
【问题讨论】:
-
我也尝试使用会话超时中的数字,1*60 等
-
您链接到的代码是否有任何文档?我想更详细地了解为什么选择这种方法。