CorsConfigurationSource that uses URL path patterns to select the
CorsConfiguration for a request.
Pattern matching can be done with a PathMatcher or with pre-parsed
PathPatterns. The syntax is largely the same with the latter being more
tailored for web usage and more efficient. The choice depends on the presence of a
resolved String lookupPath or a
parsed RequestPath
with a fallback on PathMatcher but the fallback can be disabled.
For more details, please see setAllowInitLookupPath(boolean).
PathPattern, AntPathMatcher
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final Map | |
| private static final PathMatcher | |
| private String | |
| private PathMatcher | |
| private final PathPatternParser | |
| private UrlPathHelper |
| Access | Constructor and Description |
|---|---|
| public | |
| public | UrlBasedCorsConfigurationSource(PathPatternParser
the parser to use parser)Constructor with a |
| Modifier and Type | Method and Description |
|---|---|
| public CorsConfiguration | getCorsConfiguration(HttpServletRequest request)
Implements org. Return a |
| public Map | |
| private void | |
| private boolean | |
| public void | registerCorsConfiguration(String
the mapping pattern pattern, CorsConfiguration the CORS configuration to use for the pattern config)Variant of |
| private Object | |
| public void | setAllowInitLookupPath(boolean
whether to disable lazy initialization
and fail if not already resolved allowInitLookupPath)When enabled, if there is neither a
|
| public void | setAlwaysUseFullPath(boolean alwaysUseFullPath)
Deprecated
as of 5.3 in favor of using
setUrlPathHelper(UrlPathHelper), if at all.
Shortcut to the
|
| public void | setCorsConfigurations(Map<String, CorsConfiguration>
the mappings to use corsConfigurations)Set the CORS configuration mappings. |
| public void | setLookupPathAttributeName(String
the request attribute to check name)
Deprecated
as of 5.3 in favor of
UrlPathHelper#PATH_ATTRIBUTE.
Configure the name of the attribute that holds the lookupPath extracted
via |
| public void | |
| public void | setRemoveSemicolonContent(boolean removeSemicolonContent)
Deprecated
as of 5.3 in favor of using
setUrlPathHelper(UrlPathHelper), if at all.
Shortcut to the
|
| public void | setUrlDecode(boolean urlDecode)
Deprecated
as of 5.3 in favor of using
setUrlPathHelper(UrlPathHelper), if at all.
Shortcut to the
|
| public void |
| allowInitLookupPath | back to summary |
|---|---|
| private boolean allowInitLookupPath | |
| corsConfigurations | back to summary |
|---|---|
| private final Map<PathPattern, CorsConfiguration> corsConfigurations | |
| defaultPathMatcher | back to summary |
|---|---|
| private static final PathMatcher defaultPathMatcher | |
| lookupPathAttributeName | back to summary |
|---|---|
| private String lookupPathAttributeName
| |
| pathMatcher | back to summary |
|---|---|
| private PathMatcher pathMatcher | |
| patternParser | back to summary |
|---|---|
| private final PathPatternParser patternParser | |
| urlPathHelper | back to summary |
|---|---|
| private UrlPathHelper urlPathHelper | |
| UrlBasedCorsConfigurationSource | back to summary |
|---|---|
| public UrlBasedCorsConfigurationSource() Default constructor with | |
| UrlBasedCorsConfigurationSource | back to summary |
|---|---|
| public UrlBasedCorsConfigurationSource(PathPatternParser parser) Constructor with a
| |
| getCorsConfiguration | back to summary |
|---|---|
| public CorsConfiguration getCorsConfiguration(HttpServletRequest request) Implements org. Doc from org. Return a
| |
| getCorsConfigurations | back to summary |
|---|---|
| public Map Return all configured CORS mappings. | |
| initUrlPathHelper | back to summary |
|---|---|
| private void initUrlPathHelper() | |
| match | back to summary |
|---|---|
| private boolean match(Object path, boolean isPathContainer, PathPattern pattern) | |
| registerCorsConfiguration | back to summary |
|---|---|
| public void registerCorsConfiguration(String pattern, CorsConfiguration config) Variant of
| |
| resolvePath | back to summary |
|---|---|
private Object resolvePath(HttpServletRequest request)
| |
| setAllowInitLookupPath | back to summary |
|---|---|
| public void setAllowInitLookupPath(boolean allowInitLookupPath) When enabled, if there is neither a
In Spring MVC, either a resolved String lookupPath or a parsed
By default this is set to
| |
| setAlwaysUseFullPath | back to summary |
|---|---|
| public void setAlwaysUseFullPath(boolean alwaysUseFullPath)
Deprecated as of 5.3 in favor of using
Shortcut to the
| |
| setCorsConfigurations | back to summary |
|---|---|
| public void setCorsConfigurations(Map<String, CorsConfiguration> corsConfigurations) Set the CORS configuration mappings. For pattern syntax see
| |
| setLookupPathAttributeName | back to summary |
|---|---|
| public void setLookupPathAttributeName(String name)
Deprecated as of 5.3 in favor of Configure the name of the attribute that holds the lookupPath extracted
via By default this is
| |
| setPathMatcher | back to summary |
|---|---|
| public void setPathMatcher(PathMatcher pathMatcher) Configure a This is an advanced property that should be used only when a
customized By default this is Note Setting | |
| setRemoveSemicolonContent | back to summary |
|---|---|
| public void setRemoveSemicolonContent(boolean removeSemicolonContent)
Deprecated as of 5.3 in favor of using
Shortcut to the
| |
| setUrlDecode | back to summary |
|---|---|
| public void setUrlDecode(boolean urlDecode)
Deprecated as of 5.3 in favor of using
Shortcut to the
| |
| setUrlPathHelper | back to summary |
|---|---|
| public void setUrlPathHelper(UrlPathHelper urlPathHelper) Configure the By default this is | |