title: Authorization redirect on session expiration does not work on submitting a JSF form, page stays the same
body: <p>I am using JSF2. I have implemented a custom faces servlet like so:</p>
  
  <pre><code>public class MyFacesServletWrapper extends MyFacesServlet {
      // ...
  }
  </code></pre>
  
  <p>wherein I'm doing some authorization checks and sending a redirect when the user is not logged in:</p>
  
  <pre><code>public void service(ServletRequest request, ServletResponse response) {
      HttpServletRequest req = (HttpServletRequest) request;
      HttpServletResponse res = (HttpServletResponse) response;
  
      if (...) {
          String loginURL = req.getContextPath() + "/LoginPage.faces";
          res.sendRedirect(loginURL);
      }
  }
  </code></pre>
  
  <p>This works when the user tries to navigate to another page. However, this does not work when a JSF form is submitted by a JSF command link/button. The line <code>sendRedirect()</code> line is hit and executed, no exception is been thrown, but the user stays at the same page. Basically, there's no visual change at all.</p>
  
  <p>Why does this work on page navigation, but not on form submit?</p>