- Client device clears all cookies (so, no
JSESSIONIDcookie exists on the client). - Client makes a request to Spring controller.
- Spring Interceptor intercepts the request.
In the very first line of the preHandle() method of the Spring interceptor, I log the value of request.getRequestedSessionId() and the logs show a value for this, which should mean that a JSESSIONID was, in fact, received from the client. However, my Fiddler logs show that no JSESSIONID was sent in the request.
In addition, request.getSession(false).getId() returns that same JSESSIONID.
So, how/when/why were the session and JSESSIONID created before the interceptor is even reached? I would expect request.getRequestedSessionId() to be null if no JSESSIONID cookie was sent by the client.
And how do I prevent sessions from being created "on the fly" like this?
If it matters, the resource being requested is implemented like this:
@Controller
public class LoginController {
.
.
.
@RequestMapping(value = { "/controller/index.do" })
public final ModelAndView login(final HttpServletRequest request, final HttpServletResponse response) {
.
.
.
EDIT - As mentioned in this answer, I unserstand that every call to JSP page implicitly creates new session if there is no session yet. But would this happen before the interceptor is reached?
EDIT2 - The interceptor is an instance of org.springframework.web.servlet.handler.HandlerInterceptorAdapter