23 lines
682 B
Java
23 lines
682 B
Java
package com.common.base.config;
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
import javax.websocket.HandshakeResponse;
|
|
import javax.websocket.server.HandshakeRequest;
|
|
import javax.websocket.server.ServerEndpointConfig;
|
|
import javax.websocket.server.ServerEndpointConfig.Configurator;
|
|
/*
|
|
* 获取HttpSession
|
|
*
|
|
*/
|
|
|
|
public class GetHttpSession extends Configurator {
|
|
|
|
@Override
|
|
public void modifyHandshake(ServerEndpointConfig sec,
|
|
HandshakeRequest request, HandshakeResponse response) {
|
|
HttpSession httpSession=(HttpSession) request.getHttpSession();
|
|
sec.getUserProperties().put(HttpSession.class.getName(),httpSession);
|
|
}
|
|
|
|
}
|