类 CorsWebFilter
- java.lang.Object
- org.springframework.web.cors.reactive.CorsWebFilter
- 所有已实现的接口:
WebFilter
public class CorsWebFilter extends Object implements WebFilter
WebFilter
that handles CORS preflight requests and intercepts CORS simple and actual requests thanks to aCorsProcessor
implementation (DefaultCorsProcessor
by default) in order to add the relevant CORS response headers (likeAccess-Control-Allow-Origin
) using the providedCorsConfigurationSource
(for example anUrlBasedCorsConfigurationSource
instance.This is an alternative to Spring WebFlux Java config CORS configuration, mostly useful for applications using the functional API.
- 从以下版本开始:
- 5.0
- 作者:
- Sebastien Deleuze
- 另请参阅:
- CORS W3C recommendation
构造器概要
构造器 构造器 说明 CorsWebFilter(CorsConfigurationSource configSource)
Constructor accepting aCorsConfigurationSource
used by the filter to find theCorsConfiguration
to use for each incoming request.CorsWebFilter(CorsConfigurationSource configSource, CorsProcessor processor)
Constructor accepting aCorsConfigurationSource
used by the filter to find theCorsConfiguration
to use for each incoming request and a customCorsProcessor
to use to apply the matchedCorsConfiguration
for a request.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 reactor.core.publisher.Mono<Void>
filter(ServerWebExchange exchange, WebFilterChain chain)
Process the Web request and (optionally) delegate to the nextWebFilter
through the givenWebFilterChain
.
构造器详细资料
CorsWebFilter
public CorsWebFilter(CorsConfigurationSource configSource)
Constructor accepting aCorsConfigurationSource
used by the filter to find theCorsConfiguration
to use for each incoming request.
CorsWebFilter
public CorsWebFilter(CorsConfigurationSource configSource, CorsProcessor processor)
Constructor accepting aCorsConfigurationSource
used by the filter to find theCorsConfiguration
to use for each incoming request and a customCorsProcessor
to use to apply the matchedCorsConfiguration
for a request.
方法详细资料
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
.