Closed mduchemin closed 1 year ago
Thank you for reporting this. We will check.
I have seen that Glasfish 7.0.1 has been released (https://github.com/eclipse-ee4j/glassfish/releases/tag/7.0.1) but I guess it doesn't include a fix for this, right?
No, not yet, sorry.
Sorry if this is issue report is a bit messy, I'm not a usual contributor, just working with a product using websockets, and found an issue while testing Glassfish 7.0.0 which I think I should bring to attention before full release.
The product I'm using has a websocket configurator extending:
... extends Endpoint //javax.xml.ws.Endpoint
Which declares an onOpen method as
public void onOpen(final Session wsession, EndpointConfig config) {
which is correctly found as a programmaticEndpoint by the TyrusEndpointWrapper during
org.glassfish.tyrus.core.TyrusEndpointWrapper.TyrusEndpointWrapper(Endpoint, EndpointConfig, ComponentProviderService, WebSocketContainer, String, Configurator, SessionListener, ClusterContext, EndpointEventListener, Boolean)
This method expects to find userProperties on the config, containing user properties in a map to match relevant sessions to their relevant content.
However, on Glassfish 7.0.0, the map user properties is always empty, because it is being filled during
org.glassfish.tyrus.core.TyrusEndpointWrapper.onHandShakeResponse(UpgradeRequest, UpgradeResponse)
At that stage, the TyrusEndpointWrapper passes a ServerEndpointConfigWrapper, which has the same interface as the regular ServerEndpointConfig. The product does store the relevant information for the websocket session using the ServerEndpointConfigWrapper.getUserProperties method to retrieve the properties Map. However, this retrieves the wrapper's properties, not the actual underlying ServerEndpointConfig properties.
Since the wrapped config is not passed to onOpen during
This causes the userProperties to not be available during onOpen
I don't have an easy-to-run reproducing case currently, but I can build one if necessary.
relevant links: https://github.com/eclipse-ee4j/tyrus/commits/2.1.2/core/src/main/java/org/glassfish/tyrus/core/ServerEndpointConfigWrapper.java
https://github.com/eclipse-ee4j/tyrus/blob/eb220f723f3eaa86900bd58aebb77d7a61429acc/core/src/main/java/org/glassfish/tyrus/core/TyrusEndpointWrapper.java