2019-11-01 15:54

@JFinal
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
Map> headers = request.getHeaders();
List cookieList = headers.get("Cookie");
Map kv = MapUtil.newHashMap();
if(CollUtil.isNotEmpty(cookieList)) {
String cookieStr = cookieList.get(0);
String[] cookieArray = cookieStr.split("; ");
for(String cookie : cookieArray){
String[] cookieKv = cookie.split("=");
kv.put(cookieKv[0], cookieKv[1]);
}
}
String sessionId = kv.get(LoginService.sessionIdName);
sec.getUserProperties().put(String.class.getName(),sessionId);
}
List cookieList = headers.get("Cookie");
这段代码为什么拿不到Cookie信息?
运行环境为:
jfinal-undertow1.9
undertow-websockets-jsr2.0.25.Final
jfinal4.6