SaveSession
GatewayFilter
Factory
SaveSession
GatewayFilter
工厂强制执行 WebSession::save
操作 before,将调用转发到下游。在将延迟数据存储与类似 Spring Session 的功能结合使用时,此功能特别有用,并且你需要确保已保存会话状态然后再进行转发的调用。以下示例配置了一个 SaveSession
GatewayFilter
:
The SaveSession
GatewayFilter
factory forces a WebSession::save
operation before forwarding the call downstream.
This is of particular use when using something like Spring Session with a lazy data store, and you need to ensure the session state has been saved before making the forwarded call.
The following example configures a SaveSession
GatewayFilter
:
application.yml
spring:
cloud:
gateway:
routes:
- id: save_session
uri: https://example.org
predicates:
- Path=/foo/**
filters:
- SaveSession
如果你将 Spring Security 与 Spring Session 集成并希望确保安全详细信息已转发到远程进程,这一点至关重要。
If you integrate Spring Security with Spring Session and want to ensure security details have been forwarded to the remote process, this is critical.