Although Joachimโs answer gives a hint in the right direction, I believe that he doesnโt fully answer the question or, at least, can be supplemented.
To get a cookie value, you must get the headers of the HandshakeRequest object and look at the header with the name cookie. Your modifyHandshake implementation will look something like this:
public class MyEndpointConfigurator extends ServerEndpointConfig.Configurator { @Override public void modifyHandshake(ServerEndpointConfig config, HandshakeRequest request, HandshakeResponse response) { Map<String,List<String>> headers = request.getHeaders(); config.getUserProperties().put("cookie",headers.get("cookie")); } }
source share