-
Bug
-
Resolution: Fixed
-
Normal
-
Freshly, 9.6.0
-
Jetty 11
9.6.0-jakarta.FL
Steps to Reproduce
Use 9.6.0-jakarta FL in Jetty 11, and open WebSocket
<!-- zk.xml --> <listener> <listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class> </listener> <!-- test.zul --> <zk> <button onClick="Clients.log(event.toString())" label="test event"/> </zk>
Current Result
A "ZK Session cannot be null!" exception and use failsafe ajax
Expected Result
Established a WebSocket connection
Debug Information
https://github.com/zkoss/zk/blob/v9.5.1.3/zk/src/org/zkoss/zk/ui/http/ZKWebSocket.java#L71
In Session.getRequestParameterMap, connection_uuid was missing.
There is a fake request in org.zkoss.zkmax.au.websocket.WebSocketFilter to add connection_uuid in requestParameterMap, but Jetty 11 won't use it.
Instead, org.eclipse.jetty.websocket.core.internal.Negotiated parses the query string (ws://localhost:8080/zkwm?dtid=z_83A8Jz9FIG5uoAWPYdaPzQ) as a newly created parameter map.
https://github.com/eclipse/jetty.project/blob/jetty-9.4.42.v20210604/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/JsrSession.java#L285
https://github.com/eclipse/jetty.project/blob/jetty-11.0.4/jetty-websocket/websocket-jakarta-common/src/main/java/org/eclipse/jetty/websocket/jakarta/common/JakartaWebSocketSession.java#L499
The "Solution Using Request Parameters" workaround from https://stackoverflow.com/a/30180015 is not working anymore.