大气错误:WebSocket握手期间出错:意外的响应代码:501



运行Glassfish后,我在浏览器控制台(Chrome)中收到错误:


从api到"ws://localhost:8080/mcweb/primebush/result"的WebSocket连接?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-atmoprotocol=true'失败:WebSocket握手期间出错:意外的响应代码:501

Websocket失败。降级到Comet并重新发送


GlassFish服务器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>

尝试使用大气2.1.4版本,并将此片段放在代码中:

<h:outputScript
  library="primefaces"
  name="push/push.js"
  target="head"
/>

相关内容

  • 没有找到相关文章

最新更新