public class UrlBasedCorsConfigurationSource extends 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. |
Map<String,CorsConfiguration> |
getCorsConfigurations()
Get the CORS configuration.
|
void |
registerCorsConfiguration(String path,
CorsConfiguration config)
Register a
CorsConfiguration for the specified path pattern. |
void |
setAlwaysUseFullPath(boolean alwaysUseFullPath)
Set if URL lookup should always use the full path within the current servlet
context.
|
void |
setCorsConfigurations(Map<String,CorsConfiguration> corsConfigurations)
Set CORS configuration based on URL patterns.
|
void |
setPathMatcher(org.springframework.util.PathMatcher pathMatcher)
Set the PathMatcher implementation to use for matching URL paths
against registered URL patterns.
|
void |
setRemoveSemicolonContent(boolean removeSemicolonContent)
Set if ";" (semicolon) content should be stripped from the request URI.
|
void |
setUrlDecode(boolean urlDecode)
Set if context path and request URI should be URL-decoded.
|
void |
setUrlPathHelper(UrlPathHelper urlPathHelper)
Set the UrlPathHelper to use for resolution of lookup paths.
|
public void setPathMatcher(org.springframework.util.PathMatcher pathMatcher)
AntPathMatcher
public void setAlwaysUseFullPath(boolean alwaysUseFullPath)
Default is "false".
public void setUrlDecode(boolean urlDecode)
Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).
UrlPathHelper.setUrlDecode(boolean)
public void setRemoveSemicolonContent(boolean removeSemicolonContent)
The default value is true
.
public void setUrlPathHelper(UrlPathHelper urlPathHelper)
Use this to override the default UrlPathHelper with a custom subclass.
public void setCorsConfigurations(Map<String,CorsConfiguration> corsConfigurations)
public Map<String,CorsConfiguration> getCorsConfigurations()
public void registerCorsConfiguration(String path, CorsConfiguration config)
CorsConfiguration
for the specified path pattern.public CorsConfiguration getCorsConfiguration(HttpServletRequest request)
CorsConfigurationSource
CorsConfiguration
based on the incoming request.getCorsConfiguration
in interface CorsConfigurationSource
CorsConfiguration
, or null
if none