Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要对会话超时逻辑以及如何处理超时进行一些测试,但我不想等待会话超时。现在需要 30 分钟不活动才能超时,有没有办法将其更改为更短的时间范围,或者更好的是,在我想要的时候强制超时?
您可以通过调用 HTTPSession#invalidate 使 HTTP 会话无效,这与超时期间发生的情况非常相似。您可以使用 JSP 轻松完成此操作。
HttpSession session = request.getSession(false); if (session != null) { session.invalidate(); }
您还可以在 WAS 控制台中调整应用程序级别的超时:
All Applications > $yourapp > Session management