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);
}
}
网友评论