Class 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.- Since:
- 4.2
- Author:
- Sebastien Deleuze
- See Also:
CorsRegistration
Constructor Summary
Constructors Constructor Description CorsRegistry()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
Constructor Detail
CorsRegistry
public CorsRegistry()
Method Detail
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.- Parameters:
pathPattern
- the path pattern to enable CORS handling for- Returns:
- CorsRegistration the corresponding registration object, allowing for further fine-tuning
getCorsConfigurations
protected Map<String,CorsConfiguration> getCorsConfigurations()
Return the registeredCorsConfiguration
objects, keyed by path pattern.