public class UrlBasedCorsConfigurationSource extends Object implements CorsConfigurationSource
CorsConfigurationSource
that uses URL patterns to select the
CorsConfiguration
for a request.PathPattern
Constructor and Description |
---|
UrlBasedCorsConfigurationSource()
Construct a new
UrlBasedCorsConfigurationSource instance with default
PathPatternParser . |
UrlBasedCorsConfigurationSource(PathPatternParser patternParser)
Construct a new
UrlBasedCorsConfigurationSource instance from the supplied
PathPatternParser . |
Modifier and Type | Method and Description |
---|---|
CorsConfiguration |
getCorsConfiguration(ServerWebExchange exchange)
Return a
CorsConfiguration based on the incoming request. |
void |
registerCorsConfiguration(String path,
CorsConfiguration config)
Register a
CorsConfiguration for the specified path pattern. |
void |
setCorsConfigurations(Map<String,CorsConfiguration> configMap)
Set CORS configuration based on URL patterns.
|
public UrlBasedCorsConfigurationSource()
UrlBasedCorsConfigurationSource
instance with default
PathPatternParser
.public UrlBasedCorsConfigurationSource(PathPatternParser patternParser)
UrlBasedCorsConfigurationSource
instance from the supplied
PathPatternParser
.public void setCorsConfigurations(@Nullable Map<String,CorsConfiguration> configMap)
public void registerCorsConfiguration(String path, CorsConfiguration config)
CorsConfiguration
for the specified path pattern.@Nullable public CorsConfiguration getCorsConfiguration(ServerWebExchange exchange)
CorsConfigurationSource
CorsConfiguration
based on the incoming request.getCorsConfiguration
in interface CorsConfigurationSource
CorsConfiguration
, or null
if none