title: JSF Ajax event not extending session.maxInactiveInterval
body: <p>I have two web pages <code>index.xhtml</code> and <code>sessionExpiry.xhtml</code>.  Objective is to redirect user to <code>sessionExpiry.xhtml</code> page upon timeout.  I have made session timeout to be 1 minute in <code>web.xml</code>.  I am using <code>http-equiv=refresh</code> tag to redirect user upon timeout.
  <code>index.xhtml</code> has a mandatory text field which displays a error message upon <code>onblur event</code> if nothing is entered.  Added a <code>HttpSessionListener</code> to record session creation and destruction.</p>
  
  <p><strong>Test scenario:</strong> Open the web page in browser, session creation time displayed on server logs, after 15 seconds, clicked on input text box and clicked outside and rich error message is displayed.  Left the web page idle, web page redirects to <code>sessionExpiry.xhtml</code> after 1 min (I was expecting this to happen after 1 min 15 sec), but the session destroyed message on server logs is happening around 2-3 mins.</p>
  
  <p>Why is the session destroyed delayed?  How can I make session expiry happen after 1 min of inactivity after AJAX event?  Following is the source code.</p>
  
  <p><code>web.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;
      &lt;param-value&gt;Development&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;session-config&gt;
      &lt;session-timeout&gt;
          1
      &lt;/session-timeout&gt;
  &lt;/session-config&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;com.sessiontimeout.HttpSessionChecker&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.xhtml&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  </code></pre>
  
  <p></p>
  
  <p><code>index.xhtml</code></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:rich="http://richfaces.org/rich"&gt;
      &lt;h:head&gt;
          &lt;title&gt;Facelet Title&lt;/title&gt;
          &lt;meta http-equiv="refresh" content="#{session.maxInactiveInterval};url=./sessionExpiry.xhtml" /&gt;
      &lt;/h:head&gt;
      &lt;h:body&gt;
          &lt;h:form&gt;
              Hello from Facelets
              &lt;h:panelGrid columns="3"&gt;
                  Enter some text:
                  &lt;h:inputText id="txt" required="true" maxlength="16" size="20"
                               autocomplete="off" requiredMessage="Text is Required"&gt;
                      &lt;f:ajax event="blur" render="txtmsg" /&gt;
                  &lt;/h:inputText&gt;
                  &lt;rich:message id="txtmsg" for="txt" /&gt;
              &lt;/h:panelGrid&gt;
          &lt;/h:form&gt;
      &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><code>sessionExpiry.xhtml</code></p>
  
  <pre><code>&lt;h:body&gt;
          Session Timed out after ${session.maxInactiveInterval/60} minutes of inactivity.
  &lt;/h:body&gt;
  </code></pre>
  
  <p><code>HttpSessionChecker.java</code></p>
  
  <pre><code>public class HttpSessionChecker implements HttpSessionListener {
  
      public void sessionCreated(HttpSessionEvent event) {
          System.out.println("Session ID " + event.getSession().getId() + " created at " + new Date());
      }
  
      public void sessionDestroyed(HttpSessionEvent event) {
          System.out.println("Session ID " + event.getSession().getId() + " destroyed at " + new Date());
      }
  
  }
  </code></pre>