【问题标题】:Primefaces push with GlassFish 4.0Primefaces 使用 GlassFish 4.0 进行推送
【发布时间】:2013-09-12 11:24:09
【问题描述】:

有没有人成功使用上述配置?我正在尝试将 push 与 primefaces 的咆哮一起使用。我正在使用 primefaces 3.5 GlassFish 4.0 和 Atmosphere 2.0.0.RC5 我的配置如下:

<servlet>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
</servlet-mapping>

Bean 方法:

private void assaginTreatment()
  {
    ...
    PushContext pushContext = PushContextFactory.getDefault().getPushContext();
    pushContext.push("/notifications", facesMsg);
    return;
  }

最后是 xhtml 文件:

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

我得到的错误是:

SEVERE: [http-listener-1(4)] WARN org.atmosphere.cpr.MetaBroadcaster - No Broadcaster match /notifications. Message...

【问题讨论】:

  • 对于 GF4.0 Primefaces4.0.RC1 和大气 2.0.0.RC5,我遇到了同样的问题(和错误日志),同样的应用程序适用于 primefaces 3.5、大气 1.0.17 和 gf3。 1.2.2

标签: jsf-2 primefaces atmosphere glassfish-4


【解决方案1】:

Atmosphere-2.0.0.RC5,Primefaces-4.0.RC1

我设法做了一个真正不好的解决方法,但推动所有人,使它工作。对于您的用例可能就足够了

pushContext.push("/*", facesMsg);

编辑: 所以我做了一些进一步的调试并添加了更多的日志记录

if (BroadcasterFactory.getDefault() != null) {
    Collection<Broadcaster> list = BroadcasterFactory.getDefault().lookupAll();
    for (Broadcaster b : list) {
        logger.warn("id={}", b.getID() );
    }
}

输出:

Info: 2013-09-17 22:43:10,010 - id=/*
Info: 2013-09-17 22:43:10,010 - id=/notificationsprimepush

所以最后我尝试了:

pushContext.push("/notifications" + "primepush", facesMsg);

工作! :)

【讨论】:

  • 非常好,感谢您在此分享并分享到 PrimeFaces Push 论坛/社区。​​span>
  • 您还解决了 `WARN org.atmosphere.cpr.AtmosphereFramework - No BroadcasterCache 配置的另一件事。客户端重新连接之间的广播消息将丢失。建议配置org.atmosphere.cache`
猜你喜欢
  • 2012-02-09
  • 2016-06-11
  • 2015-03-22
  • 1970-01-01
  • 2015-01-09
  • 1970-01-01
  • 2013-10-20
  • 2014-03-07
  • 2012-11-09
相关资源
最近更新 更多