public class UrlBasedCorsConfigurationSource extends java.lang.Object implements CorsConfigurationSource
CorsConfiguration instance based on a
collection of CorsConfiguration mapped on path patterns.
Exact path mapping URIs (such as "/admin") are supported
as well as Ant-style path patterns (such as "/admin/**").
| Constructor and Description |
|---|
UrlBasedCorsConfigurationSource() |
| Modifier and Type | Method and Description |
|---|---|
CorsConfiguration |
getCorsConfiguration(HttpServletRequest request)
Return a
CorsConfiguration based on the incoming request. |
java.util.Map<java.lang.String,CorsConfiguration> |
getCorsConfigurations()
Get the CORS configuration.
|
void |
registerCorsConfiguration(java.lang.String path,
CorsConfiguration config)
Register a
CorsConfiguration for the specified path pattern. |
void |
setAlwaysUseFullPath(boolean alwaysUseFullPath)
Shortcut to same property on underlying
UrlPathHelper. |
void |
setCorsConfigurations(java.util.Map<java.lang.String,CorsConfiguration> corsConfigurations)
Set CORS configuration based on URL patterns.
|
void |
setPathMatcher(PathMatcher pathMatcher)
Set the PathMatcher implementation to use for matching URL paths
against registered URL patterns.
|
void |
setRemoveSemicolonContent(boolean removeSemicolonContent)
Shortcut to same property on underlying
UrlPathHelper. |
void |
setUrlDecode(boolean urlDecode)
Shortcut to same property on underlying
UrlPathHelper. |
void |
setUrlPathHelper(UrlPathHelper urlPathHelper)
Set the UrlPathHelper to use for resolution of lookup paths.
|
public void setPathMatcher(PathMatcher pathMatcher)
AntPathMatcherpublic void setAlwaysUseFullPath(boolean alwaysUseFullPath)
UrlPathHelper.public void setUrlDecode(boolean urlDecode)
UrlPathHelper.UrlPathHelper.setUrlDecode(boolean)public void setRemoveSemicolonContent(boolean removeSemicolonContent)
UrlPathHelper.public void setUrlPathHelper(UrlPathHelper urlPathHelper)
Use this to override the default UrlPathHelper with a custom subclass.
public void setCorsConfigurations(@Nullable java.util.Map<java.lang.String,CorsConfiguration> corsConfigurations)
public java.util.Map<java.lang.String,CorsConfiguration> getCorsConfigurations()
public void registerCorsConfiguration(java.lang.String path,
CorsConfiguration config)
CorsConfiguration for the specified path pattern.@Nullable public CorsConfiguration getCorsConfiguration(HttpServletRequest request)
CorsConfigurationSourceCorsConfiguration based on the incoming request.getCorsConfiguration in interface CorsConfigurationSourceCorsConfiguration, or null if none