I am developing a single page web application. I have included a java filter to intercept the html page request. So in this filter I am creating a session using request.getSession()
.
And then I am setting the JSESSIONID
cookie explicitly as I have to set the HttpOnly
flag in the response header Set-Cookie
to prevent the XSS attack through document.cookie
on client side.
Now after login I need the session, so I am accessing the session using request.getSession()
. And according to the HttpServletRequest
javadoc HttpServletRequest javadoc
request.getSession() returns the current session associated with this request, or if the request does not have a session, creates one.
But I am getting a different session after login.