当我运行这个java代码时,有人可以解释一下:
HttpSession session = request.getSession(false);
if (session != null)
{
s_log.debug("Session has id: " + session.getId());
session.invalidate();
}
s_log.debug("Request Session ID is: "+ request.getRequestedSessionId());
s_log.debug("Request isRequestedSessionIdValid(): " + request.isRequestedSessionIdValid());
HttpSession _session = request.getSession(true);
s_log.debug("New Session is :" + _session.getId());
当当前请求会话为空且无效时,为什么我从request.getSession(true)获取新会话?我在日志中看到了这一点:
请求会话ID为:0000MYF8m5fpUjrzUHIp93yshSh:5e7fcdcf-2274-43bb-83d9-4d9b9a1d766a
请求isRequestedSessionIdValid():false
新会议是:MYF8m5fpUjrzUHIp93yshSh