Sometimes there are needs to access HttpSession and cookies from HandshakeRequest, but the Java websocket API doesn't provide methods to do so.
A workaround is put HttpSession and cookies from HandshakeRequest to UserProperties before onOpen, and then javax.websocket.Session.getUserProperties.get(...) can be used to retrieve the HttpSession put in earlier. This require a custom configurator, immutant.websocket/create-servlet doesn't seem to allow custom configurator at the moment. It will be good if immutant's websocket API can take in custom configurator.
The link below to StackOverflow provides more info: