12 Replies Latest reply on Jul 23, 2014 12:33 PM by dvohra21

    Page has expired. Redirect to login.

    osiris1982

      Hello,

       

      I am trying to redirect to the Login page when the page has expired. I have set for debugging a timeout = 4 mins in the web.xml. In this way, the popUp indicating that the page has expired is shown correctly. So far so perfect.

       

      Digging in this forum I have found two alternatives to manage the timeout, using a TimeOutFilter and using a TimeOutListener.

       

      Now I am using the Filter approach that is as follows:

       

      public class TimeOutFilter implements Filter {
          private FilterConfig _filterConfig = null;
      
      
          public void init(FilterConfig filterConfig) throws ServletException {
              _filterConfig = filterConfig;
          }
      
      
          public void destroy() {
              _filterConfig = null;
          }
      
      
          public void doFilter(ServletRequest request, ServletResponse response,
                               FilterChain chain) throws IOException,
                                                         ServletException {
              String requestedSession =
                  ((HttpServletRequest)request).getRequestedSessionId();
              String currentWebSession =
                  ((HttpServletRequest)request).getSession().getId();
              boolean sessionOk =
                  currentWebSession.equalsIgnoreCase(requestedSession);
              // if the requested session is null then this is the first application
              // request and “false” is acceptable
              if (!sessionOk && requestedSession != null) {
                  // the session has expired or renewed. Redirect request
                  ((HttpServletResponse)response).sendRedirect("faces/login");
              } else {
                  chain.doFilter(request, response);
              }
          }
      }
      
      

       

      The following condition is TRUE only in one case, and therefore, this is my problem.

       

      if (!sessionOk && requestedSession != null) {
      
      

       

      I have an application using ADF Framework 12c with different tabs, when the page expires over these tabs the above "if condition" is TRUE (sessionOk=false). However, when the page expires over a window opened using af:commandMenuItem useWindow="true", the above "if condition" is FALSE (sessionOK=true), and therefore, It is not redirected to the login page but redirects to the page where the window was open, it means, the page with the tabs.

       

      I am doing something wrong? Any idea why the session is not re-new or is not invalidated in this case?

       

      Thanks in advance.