api gateway 网关设置cookie
2020-11-26 本文已影响0人
JeffreyTaiT
Filter中存入:
serverWebExchange.getResponse().addCookie(ResponseCookie.from("sessionId", webSessionId).path("/").maxAge(Duration.ofDays(1)).build());
Filter中获取:
HttpCookie httpCookie =exchange.getRequest().getCookies().getFirst("token");
if (null != httpCookie) {
String token = httpCookie.getValue();
System.out.println(token);
}
}