Problem with idleMonitor in PF 5.0 and 5.1

UI Components for JSF
Post Reply
User avatar
bonnymwas
Posts: 6
Joined: 27 Feb 2014, 11:36
Location: Nairobi, Kenya

17 Oct 2014, 11:42

While using PF 4.0, this piece of code worked like magic:

Code: Select all

<p:idleMonitor >
   <p:ajax event="idle" listener="#{userAuthenticationBean.handlePageLock}" />
</p:idleMonitor>
When using PF 5.0 and later PF 5.1, the ajax request is never fired. I tested with:

Code: Select all

<p:idleMonitor timeout="5000" 
      onidle="PF('idleDialog').show();" 
      onactive="PF('idleDialog').hide();"/>
                                    
<p:dialog header="What's happening?" widgetVar="idleDialog" modal="true">
      <h:outputText value="Dude, are you there?" />
</p:dialog>
and idleMonitor worked so to that level the component behaves well. I also verified that my backing bean logic is working well when it was invoked by using the polling component.

My backing bean

Code: Select all

public void handlePageLock() {
        try {
            FacesContext.getCurrentInstance().getExternalContext()
                    .redirect("page_lock");
            System.out.println("HANDLE PAGE LOCK INVOKED");
        } catch (Exception e) {
            logger.log(Level.SEVERE, "handlePageLock", e);
        }
    }
Furthermore, there is no documented change for this component yet the ajax requests are not being serviced. @cagaty, anything the matter?

Code: Select all

Primefaces 5.1 | Java EE 7 | Netbeans 8.0.1 | Glassfish 4.1 | Maven 3.2.3 
<----
The greatness of a man is determined by the cause he lives for and his willingness to pay a price for that cause.
------>

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

17 Oct 2014, 13:08

I think your java method should take an event...

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

17 Oct 2014, 13:14

hmmmm remarkable, the showcase works and does not have a parameter either in the java bean...

Then maybe your scope is to short?

User avatar
bonnymwas
Posts: 6
Joined: 27 Feb 2014, 11:36
Location: Nairobi, Kenya

17 Oct 2014, 13:33

As i stated earlier on, there exists no documentation detailing the change of idleMonitor.
Have a look at this http://www.primefaces.org/showcase/ui/m ... itor.xhtml
then this https://speakerdeck.com/cagataycivici/p ... ?slide=244

You will note that in the showcase, the idleMonitor uses a managed bean with two methods and none of the methods take any event. What is weird is that I am using the same implementation of the idleMonitor as used (for several versions now) in the showcase yet the ajax request in my case is never fired.

I am using session scoped beans so i guess there is no problem there.

Code: Select all

Primefaces 5.1 | Java EE 7 | Netbeans 8.0.1 | Glassfish 4.1 | Maven 3.2.3 
<----
The greatness of a man is determined by the cause he lives for and his willingness to pay a price for that cause.
------>

User avatar
bonnymwas
Posts: 6
Joined: 27 Feb 2014, 11:36
Location: Nairobi, Kenya

21 Oct 2014, 13:37

Finally found where the bug was. PF 5.1 is using Jquery v1.11.0 and in my views I was using Jquery v1.10.2. I believe this is where the discord was so i removed the outdated Jquery and used PFs Jquery.

Code: Select all

Primefaces 5.1 | Java EE 7 | Netbeans 8.0.1 | Glassfish 4.1 | Maven 3.2.3 
<----
The greatness of a man is determined by the cause he lives for and his willingness to pay a price for that cause.
------>

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

21 Oct 2014, 14:15

Great you found it and thanks for reporting back. Again, one of the reasons to never post code snippets, but post fully working but minimalistic examples.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 52 guests