Hello, I have a Spring controller which is putting a variable in the session:
public class LoginFormController extends SimpleFormController {
public ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command) throws Exception {
request.getSession().setAttribute("authenticated_user", "authenticated_user");
}
}
I then have a HandlerInterceptor. In the preHandle method, I check for the variable in the session:
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response,
Object handler) throws Exception {
/* first, check if the requested view even required authentication */
if (isAuthenticationRequired(request)) {
/* check to see that user is logged in */
if (null == request.getSession().getAttribute("authenticated_user")) {
forwardToLogonPage(request, response);
return false;
}
/* all is ok - pass the request on */
return true;
}
/* all is ok - pass the request on */
return true;
}
The problem is it seems that the session variable is not being set since request.getSession().getAttribute("authenticated_user")) is always resolving to null.
Any ideas plz?
Thanks, Krt_Malta