Spring Webflow,带有彗星的Primefaces(大气) [英] Spring Webflow , Primefaces with Comet (Atmosphere)
问题描述
打算使用带有Primefaces的Spring Web Flow启动项目。我需要使用彗星,所以我发现Primefaces使用Atmosphere。我对大气/彗星业务的经验不是很丰富,因此欢迎从任何起点入手。
Thinking to start a project using Spring Web Flow with Primefaces. I need to use comet so i figured Primefaces uses Atmosphere. I'm not really experienced with the Atmosphere / Comet business so any pointers about where to start is welcomed.
感谢进阶
推荐答案
在primefaces展示柜中可以找到一个非常基本的示例: https://www.primefaces.org/showcase/push/chat.xhtml
这是ajax推送组件的旧示例,并且未正式包含在节目中现在就解决问题,因为如果我知道的话,它将在素数3中重做。除此之外,您还必须在web.xml中配置Comet servlet:
a very basic example can be found in the primefaces showcase: https://www.primefaces.org/showcase/push/chat.xhtml This is the old example for the ajax push component and is NOT officially included in the show case right now because it will be redone in primefaces 3 if I know right. In addition to that you have to configure the comet servlet within your web.xml:
<servlet>
<servlet-name>Comet Servlet</servlet-name>
<servlet-class>org.primefaces.comet.PrimeFacesCometServlet</servlet-class>
<init-param>
<param-name>org.atmosphere.useBlocking</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Comet Servlet</servlet-name>
<url-pattern>/primefaces_comet/*</url-pattern>
</servlet-mapping>
如果您使用的是primefaces 2.2,则不能使用我认为的最新版的air / comet。我以以下依赖项运行它:
If you use primefaces 2.2 you cannot use the newest version of atmosphere/comet I think. I got it running with the following dependencies:
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-compat-tomcat</artifactId>
<version>0.5</version>
</dependency>
最后一步是在META-INF目录中添加一个名为 atmosphere.xml的文件,其中包含以下内容:
The last step is to add a file named "atmosphere.xml" within your META-INF directory with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<atmosphere-handlers>
<atmosphere-handler context-root="/primefaces_comet/*" class- name="org.primefaces.comet.PrimeFacesCometHandler" />
</atmosphere-handlers>
Jens
这篇关于Spring Webflow,带有彗星的Primefaces(大气)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!