2 Replies Latest reply on Jan 22, 2009 3:43 AM by Alexander Chubenko

    Graceful session expiration.

    Ilya Kalujny Newbie

      i`ve been looking around for implementing graceful session expiration, and i`ve stumbled into useful bits of information here and there, but never saw this all in one place.

      Here is a portion of main panel:

       <rich:modalPanel id="sessionExpiredPanel" zindex="2000"
       minWidth="100" minHeight="100"
       width="100" height="100">
       <h:outputText value="Your session has expired." />
       <script type="text/javascript">
       A4J.AJAX.onExpired = function(loc, expiredMsg) {
       Richfaces.showModalPanel('sessionExpiredPanel',{width:450, top:200});;
       <a4j:poll id="sessioncheck" interval="620000" reRender="sessioncheck" />

      and here is what session time out is set to in web.xml


      The code is quite self-explanatory, but i`ll just repeat it: the idea is to have a separate empty a4j:poll that pings the server in periods bit larger then your session expiration. When session is expired and poll fires A4J.AJAX.onExpired override kicks in.

      Hope this proves helpful to someone.