Announcement Announcement Module
Collapse
No announcement yet.
trap and handle session timeout Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • trap and handle session timeout

    I have written an interceptor according to what I found in another thread opn this forum to catch session timeouts.
    Code:
        public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
            HttpSession session = request.getSession();
            session.
            if (session == null) {
                request.setAttribute("timeout", "Your session has timed out. "
                        + "Please log in again if you want to continue to use FI-RACE.");
                response.sendRedirect("/login.jsp");
                return false;
            }
            return super.preHandle(request, response, handler);
        }
    this interceptor gets called, but the session is never null.

    Does anyone have any suggestions as to what I need to check to know that the session has timed put?
    Last edited by drellim; Sep 26th, 2008, 08:43 AM. Reason: better subject

  • #2
    Originally posted by drellim View Post
    HttpSession session = request.getSession();
    This creates a session if it doesn't already exist, hence why session is never null.

    request.getSession(false) will only return a session if it already exists.

    Comment


    • #3
      I think I've tried getSession(false) without success. I will have another go when I get a chance

      Comment

      Working...
      X