Hi Anthony
It all looks OK, except that you select the older Atmosphere version, it
has to be 2.4.3 - so start from removing that pom section where you get
an older version from the non-Central maven location.
The other thing - enabling async (suspended) continuations is not needed
for WebSocket (AFAIK), I'm not sure if it interferes, try disabling this
CXFServlet setting if using the latest Atmosphere does not help (it
would an issue of its own - but for now lets try to isolate where the
problem is)
Sergey
On 28/09/16 16:26, MULLER, Anthony wrote:
Hello CXF Experts, Sergey, Aki,
I have some issues to implement a simple test using WebSocket with CXF 3.1.7,
in a Tomcat 8 Servlet container.
To make troubleshooting easier, I shared my demo project (based on the official
CXF samples written by Aki):
https://github.com/AnthonyMullerPlayground/cxf31_websocket
The webapp context is "cxf31_websocket" and it contains a simple RESTful service running
under "/services/users" path.
The project also contains a basic index.html webpage to test the websocket.
CXF is bootstrapped using: org.apache.cxf.transport.servlet.CXFServlet
Spring is used to and configured this way with a "beans.xml" file:
<jaxrs:server id="websocketService" address="/"
transportId="http://cxf.apache.org/transports/websocket" />
<context:component-scan base-package="com.sap.businessobjects.amuller"/>
When I check the websocket using Chrome, the following error is displayed in
the Network panel of the developer tools:
Request headers:
GET ws://localhost:8080/cxf31_websocket/services HTTP/1.1
Host: localhost:8080
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: http://localhost:8080
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,fr;q=0.6
Sec-WebSocket-Key: Uc/E4OEE/BnKx/EvHUgLtQ==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Response headers:
HTTP/1.1 501 Not Implemented
Server: Apache-Coyote/1.1
X-Atmosphere-first-request: true
X-Atmosphere-tracking-id: aeeb9f45-62e8-45b4-9d37-4657988e20ec
X-Atmosphere-error: Websocket protocol not supported
Transfer-Encoding: chunked
Date: Wed, 28 Sep 2016 15:21:58 GMT
Connection: close
No error is displayed in the Eclipse console... I'm stuck because I didn't really get the
magic behind the scene. It seems that the transportId attribute is enabling the full
WebSocket logic? (transportId="http://cxf.apache.org/transports/websocket")
Thanks for your help and explanations.
Best regards,
Anthony MÜLLER