我怎么不能让Spring Cloud Gateway在这里创建会话,就像我们以前在http会话中所做的那样:
HttpSession会话= req.getSession(false); 下一行已经默认创建了一个会话,我知道在春天有一个叫做IF_REQUIRED的东西,但是在Spring Cloud Gateway中似乎不起作用。
公共类AuthenticationFilter扩展了AbstractGatewayFilterFactory {
private final static Logger log = LoggerFactory.getLogger(AuthenticationFilter.class);
@Override
public GatewayFilter apply(Object config) {
return (exchange, chain) -> {
ServerHttpRequest req = exchange.getRequest();
ServerHttpResponse res = exchange.getResponse();
Mono<WebSession> session = exchange.getSession();// this line have session ready, although different kind of session than http session