p:idleMonitor question

UI Components for JSF
Post Reply
burferd
Posts: 234
Joined: 01 May 2010, 16:15

02 Nov 2011, 22:30

Using PrimeFaces 2.2.1, glassfish 3.2

I am adding a few new pages to an old web site and the behavior is like this.
The old web site has a link to my pages.
If the user sits idle for a while, I want to retrun him to the orignal site's home page.

I added p:idleMonitor to my page and I get the behavior I expect, but only for the first time.
Here is what happpens:
1) User accesses my page and sits idle
2) User gets a timeout message and is redirected to the original home page
3) User accesses my page again and sits idle
4) User doesn't get a timeout message and redirected - he remains on my page.
I have my timeout set to 1 minute (6000ms) for testing and the page is still active after several minutes have passed, until it finally exceeds the underlying ajax timout period.

Is this the intended behavior, where the page can only timeout once?
Is there something I need to reset after the initial timeout?

Here is my idleMonitor component line:

Code: Select all

                    <p:idleMonitor onidle="idleDialog.show();" idleListener="#{sessionBean1.idleListener}" timeout="#{sessionBean1.timeout}" update="@form" />
My idleDialog composite component:

Code: Select all

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:cc="http://java.sun.com/jsf/composite"
      xmlns:comp="http://java.sun.com/jsf/composite/ezcomp"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">

  <!-- INTERFACE -->
  <cc:interface>
  </cc:interface>

  <!-- IMPLEMENTATION -->
  <cc:implementation>
      <p:dialog header="Process Timeout" widgetVar="idleDialog" modal="true" height="150" width="400" >
          <h:outputText style="font-size: 16px; font-weight: bold; width: 400px; text-align: center;" value="Your session has timed out." />
      </p:dialog>
  </cc:implementation>
</html>
And my server side listener:

Code: Select all

    public void idleListener( IdleEvent event )
    {
        try
        {
            Thread.sleep(5000);
        }
        catch( Exception e )
        {

        }
        summaryMsg = "";
        redirectAway( "http://www.oldapplicationsite.com/home.htm" );

    }
Using PrimeFaces 3.4, Mojarra 2.1.6, Glassfish 3.1.2, NetBerans 7.2, Hibernate 3.2.5 (sometimes)
Windows 7.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 23 guests