类 ServerWebExchangeContextFilter
- java.lang.Object
- org.springframework.web.filter.reactive.ServerWebExchangeContextFilter
- 所有已实现的接口:
WebFilter
public class ServerWebExchangeContextFilter extends Object implements WebFilter
Inserts an attribute in the ReactorContext
that makes the currentServerWebExchange
available under the attribute nameEXCHANGE_CONTEXT_ATTRIBUTE
. This is useful for access to the exchange without explicitly passing it to components that participate in request processing.The convenience method
get(Context)
looks up the exchange.- 从以下版本开始:
- 5.2
- 作者:
- Rossen Stoyanchev
字段概要
字段 修饰符和类型 字段 说明 static String
EXCHANGE_CONTEXT_ATTRIBUTE
Attribute name under which the exchange is saved in the context.
构造器概要
构造器 构造器 说明 ServerWebExchangeContextFilter()
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 reactor.core.publisher.Mono<Void>
filter(ServerWebExchange exchange, WebFilterChain chain)
Process the Web request and (optionally) delegate to the nextWebFilter
through the givenWebFilterChain
.static Optional<ServerWebExchange>
get(reactor.util.context.Context context)
Access theServerWebExchange
from the Reactor Context, if available, which is ifServerWebExchangeContextFilter
is configured for use and the give context was obtained from a request processing chain.
字段详细资料
EXCHANGE_CONTEXT_ATTRIBUTE
public static final String EXCHANGE_CONTEXT_ATTRIBUTE
Attribute name under which the exchange is saved in the context.
构造器详细资料
ServerWebExchangeContextFilter
public ServerWebExchangeContextFilter()
方法详细资料
filter
public reactor.core.publisher.Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain)
从接口复制的说明:WebFilter
Process the Web request and (optionally) delegate to the nextWebFilter
through the givenWebFilterChain
.
get
public static Optional<ServerWebExchange> get(reactor.util.context.Context context)
Access theServerWebExchange
from the Reactor Context, if available, which is ifServerWebExchangeContextFilter
is configured for use and the give context was obtained from a request processing chain.- 参数:
context
- the context in which to access the exchange- 返回:
- the exchange