1 Reply Latest reply on Jun 23, 2013 6:02 PM by swd847

    Accessing HttpSession from websocket Session?

    cs02rm0

      Is it possible to get hold of the HttpSession from a websocket Session in Wildfly? If so... how? Thanks.

        • 1. Re: Accessing HttpSession from websocket Session?
          swd847

          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).

          1 of 1 people found this helpful