This content has been marked as final.
Show 1 reply
-
1. Re: Accessing HttpSession from websocket Session?
swd847 Jun 23, 2013 6:02 PM (in response to cs02rm0)1 of 1 people found this helpfulNot 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).