1 of 1 people found this helpful
Not directly, as they may have different lifecycles.
I think the best you can do at the moment is supply a javax.websocket.server.ServerEndpointConfig.Configurator implementation that overrides javax.websocket.server.ServerEndpointConfig.Configurator#modifyHandshake. This can then grab any objects you need from the session, and stick them in a ThreadLocal, which you can then transfer to your web socket session.
This is not really ideal, we may implement some non-standard extensions to make this easier (maybe allow injecting the session into the @OnOpen method).