如何使用PrimeFaces websocks与Glassfish 3.1和JSF2进行服务器推送 [英] How to use PrimeFaces websocks for server push with Glassfish 3.1 and JSF2

查看:94
本文介绍了如何使用PrimeFaces websocks与Glassfish 3.1和JSF2进行服务器推送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PrimeFaces pdf表示,带有服务器推送的websocket仅适用于Jetty,但Glassfish3.1确实有一个带有灰熊的websockets组件。文档是否错误?有没有人用这两个用websockets推?这是怎么完成的?

PrimeFaces用户指南文档是正确的。请注意,它实际上告诉我们,推送servlet必须运行在不同的应用程序中,而不是JSF2应用程序本身。


6.1安装



推送服务器



PrimeFaces Push使用一个servlet作为调度器。这个servlet应该与JSF应用程序在不同的应用程序中,并且目前只能在jetty服务器上部署。


所以Jetty - 只支持应该是一个非问题。您可以继续在Glassfish中运行JSF2 Web应用程序。如果您只有一台服务器,您只需在另一个端口上并排设置并运行Jetty。



原因很可能是因为websocket不受支持标准的Servlet API规范(但是即将推出的Servlet 3.1计划)。使用Servlet 3.0和更旧版本,您需要容器特定的代码和库。 PrimeFaces可能不值得花
的努力来为各种现有的servlet容器和PrimeFaces JAR提供容器特定的代码和库。


The PrimeFaces pdf says that websockets with server push is only available with Jetty but Glassfish3.1 does have a websockets component with grizzly. Is the documentation wrong? has anyone used these two for push with websockets? How was this done?

解决方案

The PrimeFaces Users Guide documentation is right. Note that it's literally telling that the push servlet has to run in a different application than the JSF2 application itself.

6.1 Setup

Push Server

PrimeFaces Push uses a servlet as a dispatcher. This servlet should be in a different application than the JSF application and at the moment can only be deployed on jetty server.

So the Jetty-only support should be a non-issue. You can just keep running your JSF2 webapp in Glassfish. You just have to setup and run Jetty side by side on a different port if you have only one server machine.

The reason is most likely because the websockets are not supported by standard Servlet API spec (it's however planned for the upcoming Servlet 3.1). With Servlet 3.0 and older, you would need container specific code and libraries. It's for PrimeFaces likely not worth the effort to ship the container specific code and libraries for a wide range of existing servletcontainers along with the PrimeFaces JAR.

这篇关于如何使用PrimeFaces websocks与Glassfish 3.1和JSF2进行服务器推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆