//进行处理会话标识未更新
//userUrl为登录url,若为登录url则进行会话更新
if(RequestURL.equals(userUrl))
{
Enumeration<?> e = httpRequest.getParameterNames();
String attributeName;
String attributeValue;
String [] attributeValues;
sessionMap=new HashMap<Object,Object>();
while (e.hasMoreElements())
{
attributeName = (String)e.nextElement();
attributeValue=request.getParameter(attributeName);
attributeValues=request.getParameterValues(attributeName);
if(attributeValues.length<=1)
{
if(!sessionMap.containsKey(attributeName))
{
sessionMap.put(attributeName, attributeValue);
}
}
else
{
if(!sessionMap.containsKey(attributeName))
{
sessionMap.put(attributeName, attributeValues);
}
}
}
httpRequest.getSession().invalidate();
HttpSession newSession = httpRequest.getSession(true);
Cookie cookie = new Cookie("JSESSIONID", newSession.getId());
cookie.setMaxAge(-1);
cookie.setSecure(true);//false -> true fortify Cookie Security: Cookie not Sent Over SSL
cookie.setPath(httpRequest.getContextPath());
//重新创建session,设置登录时候login判断属性newSession
httpRequest.setAttribute("newSession", sessionMap);
httpResponse.addCookie(cookie);
}