public class CorsRegistration extends Object
CorsRegistration
assists with the creation of a
CorsConfiguration
instance mapped to a path pattern.
If no path pattern is specified, cross-origin request handling is
mapped to "/**"
.
By default, all origins, all headers, credentials and GET
,
HEAD
, and POST
methods are allowed, and the max age is
set to 30 minutes.
CorsConfiguration
,
CorsRegistry
Constructor and Description |
---|
CorsRegistration(String pathPattern) |
Modifier and Type | Method and Description |
---|---|
CorsRegistration |
allowCredentials(boolean allowCredentials) |
CorsRegistration |
allowedHeaders(String... headers) |
CorsRegistration |
allowedMethods(String... methods) |
CorsRegistration |
allowedOrigins(String... origins) |
CorsRegistration |
exposedHeaders(String... headers) |
protected CorsConfiguration |
getCorsConfiguration() |
protected String |
getPathPattern() |
CorsRegistration |
maxAge(long maxAge) |
public CorsRegistration(String pathPattern)
public CorsRegistration allowedOrigins(String... origins)
public CorsRegistration allowedMethods(String... methods)
public CorsRegistration allowedHeaders(String... headers)
public CorsRegistration exposedHeaders(String... headers)
public CorsRegistration maxAge(long maxAge)
public CorsRegistration allowCredentials(boolean allowCredentials)
protected String getPathPattern()
protected CorsConfiguration getCorsConfiguration()