Glassfish运行后,我在浏览器控制台(Chrome)中出错:
WebSocket连接到'ws:// localhost:8080 / mcweb / primepush / result-from-api?X-Atmosphere-tracking-id = 0& X-Atmosphere-Framework = 2.0.3-jquery& X-Atmosphere -Transport = websocket& X-Atmosphere-TrackMessageSize = true& X-Cache-Date = 0& X-atmo-protocol = true'failed:WebSocket握手期间出错:意外响应代码:501
Websocket失败了。降级为Comet并重新发送
GlassFish Server 3.1.2.2
Primefaces 4.0
的pom.xml
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>2.0.3</version>
</dependency>
的web.xml
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
<init-param>
<param-name>org.atmosphere.cpr.AtmosphereInterceptor</param-name>
<param-value>org.atmosphere.interceptor.HeartbeatInterceptor</param-value>
</init-param>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
答案 0 :(得分:0)
尝试使用大气2.1.4版本并将此代码段放在您的代码上:
<h:outputScript
library="primefaces"
name="push/push.js"
target="head"
/>