PF Push issue

UI Components for JSF
Post Reply
Curveman
Posts: 2
Joined: 28 Jan 2016, 17:51

05 Apr 2016, 21:05

Hi,

I am experiencing an issue with Primefaces Push functionnality. I am trying to show a growl when a new thread function is completed. The growl is located in an XHTML template, which is included in all my pages, with the required Socket and Script. The issue is that the Javascript function is not being called. I can see that the encoder gets triggered and return the FacesMessage but after that, nothing happens. What I find even weirder is that I have seen the growl appear only once and without changing anything since then, it doesn't work anymore. I get no exception or errors in the glassfish console, it just doesn't show up.

I have been searching and trying things for 3 days without any solution.

Glassfish 3.1.2.2
Primefaces 5.2
Netbeans 8.1

Template.xhtml

Code: Select all

<h:body styleClass="home">

        <p:growl widgetVar="growl" showDetail="true"/>
        <p:socket onMessage="handleMessage" channel="/notify"/>  
        
        <script type="text/javascript">
            function handleMessage(facesmessage) {
                facesmessage.severity = 'info';
                PF('growl').show([facesmessage]);
            }
        </script>
NotifyResourve.java

Code: Select all

import javax.ejb.Singleton;
import javax.faces.application.FacesMessage;
import org.primefaces.push.annotation.OnMessage;
import org.primefaces.push.annotation.PushEndpoint;
import org.primefaces.push.impl.JSONEncoder;
 
@PushEndpoint("/notify")
@Singleton
public class NotifyResource {
 
    @OnMessage(encoders = {JSONEncoder.class})
    public FacesMessage  onMessage(FacesMessage message) {
        return message;
    }
}
web.xml

Code: Select all

<servlet>
        <servlet-name>PrimePushServlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <init-param>
            <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
            <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
        <init-param> 
            <param-name>org.atmosphere.util.IOUtils.readGetBody</param-name> 
            <param-value>true</param-value> 
        </init-param> 
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>PrimePushServlet</servlet-name>
        <url-pattern>/primepush/*</url-pattern>
    </servlet-mapping>
Push.java

Code: Select all

String Details;
        String Summary;
        Details = StringEscapeUtils.escapeHtml4("Test");
        Summary = StringEscapeUtils.escapeHtml4("Test");
        EventBus eventBus = EventBusFactory.getDefault().eventBus(); 
        eventBus.publish("/notify", new FacesMessage(Details, Summary));

Curveman
Posts: 2
Joined: 28 Jan 2016, 17:51

06 Apr 2016, 21:43

After more tests, it works perfectly on Firefox... Issue is under IE

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 35 guests