类 CorsUtils
- java.lang.Object
- org.springframework.web.cors.reactive.CorsUtils
public abstract class CorsUtils extends Object
Utility class for CORS reactive request handling based on the CORS W3C recommendation.- 从以下版本开始:
- 5.0
- 作者:
- Sebastien Deleuze
构造器概要
构造器 构造器 说明 CorsUtils()
方法概要
所有方法 静态方法 具体方法 已过时的方法 修饰符和类型 方法 说明 static boolean
isCorsRequest(ServerHttpRequest request)
Returnstrue
if the request is a valid CORS one by checkingOrigin
header presence and ensuring that origins are different viaisSameOrigin(org.springframework.http.server.reactive.ServerHttpRequest)
.static boolean
isPreFlightRequest(ServerHttpRequest request)
Returnstrue
if the request is a valid CORS pre-flight one by checking {code OPTIONS} method withOrigin
andAccess-Control-Request-Method
headers presence.static boolean
isSameOrigin(ServerHttpRequest request)
已过时。as of 5.2, same-origin checks are performed directly byisCorsRequest(org.springframework.http.server.reactive.ServerHttpRequest)
构造器详细资料
CorsUtils
public CorsUtils()
方法详细资料
isCorsRequest
public static boolean isCorsRequest(ServerHttpRequest request)
Returnstrue
if the request is a valid CORS one by checkingOrigin
header presence and ensuring that origins are different viaisSameOrigin(org.springframework.http.server.reactive.ServerHttpRequest)
.
isPreFlightRequest
public static boolean isPreFlightRequest(ServerHttpRequest request)
Returnstrue
if the request is a valid CORS pre-flight one by checking {code OPTIONS} method withOrigin
andAccess-Control-Request-Method
headers presence.
isSameOrigin
@Deprecated public static boolean isSameOrigin(ServerHttpRequest request)
已过时。as of 5.2, same-origin checks are performed directly byisCorsRequest(org.springframework.http.server.reactive.ServerHttpRequest)
Check if the request is a same-origin one, based onOrigin
, andHost
headers.Note: as of 5.1 this method ignores
"Forwarded"
and"X-Forwarded-*"
headers that specify the client-originated address. Consider using theForwardedHeaderFilter
to extract and use, or to discard such headers.- 返回:
true
if the request is a same-origin one,false
in case of a cross-origin request