类 CorsRegistry
- java.lang.Object
- org.springframework.web.servlet.config.annotation.CorsRegistry
public class CorsRegistry extends Object
CorsRegistry
assists with the registration ofCorsConfiguration
mapped to a path pattern.- 从以下版本开始:
- 4.2
- 作者:
- Sebastien Deleuze
- 另请参阅:
CorsRegistration
构造器概要
构造器 构造器 说明 CorsRegistry()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 CorsRegistration
addMapping(String pathPattern)
Enable cross-origin request handling for the specified path pattern.protected Map<String,CorsConfiguration>
getCorsConfigurations()
Return the registeredCorsConfiguration
objects, keyed by path pattern.
构造器详细资料
CorsRegistry
public CorsRegistry()
方法详细资料
addMapping
public CorsRegistration addMapping(String pathPattern)
Enable cross-origin request handling for the specified path pattern.Exact path mapping URIs (such as
"/admin"
) are supported as well as Ant-style path patterns (such as"/admin/**"
).By default, all origins, all headers, credentials and
GET
,HEAD
, andPOST
methods are allowed, and the max age is set to 30 minutes.- 参数:
pathPattern
- the path pattern to enable CORS handling for- 返回:
- CorsRegistration the corresponding registration object, allowing for further fine-tuning
getCorsConfigurations
protected Map<String,CorsConfiguration> getCorsConfigurations()
Return the registeredCorsConfiguration
objects, keyed by path pattern.