类 UrlBasedCorsConfigurationSource
- java.lang.Object
- org.springframework.web.cors.UrlBasedCorsConfigurationSource
- 所有已实现的接口:
CorsConfigurationSource
public class UrlBasedCorsConfigurationSource extends Object implements CorsConfigurationSource
Provide a per requestCorsConfiguration
instance based on a collection ofCorsConfiguration
mapped on path patterns.Exact path mapping URIs (such as
"/admin"
) are supported as well as Ant-style path patterns (such as"/admin/**"
).- 从以下版本开始:
- 4.2
- 作者:
- Sebastien Deleuze
构造器概要
构造器 构造器 说明 UrlBasedCorsConfigurationSource()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 CorsConfiguration
getCorsConfiguration(HttpServletRequest request)
Return aCorsConfiguration
based on the incoming request.Map<String,CorsConfiguration>
getCorsConfigurations()
Get the CORS configuration.void
registerCorsConfiguration(String path, CorsConfiguration config)
Register aCorsConfiguration
for the specified path pattern.void
setAlwaysUseFullPath(boolean alwaysUseFullPath)
Shortcut to same property on underlyingUrlPathHelper
.void
setCorsConfigurations(Map<String,CorsConfiguration> corsConfigurations)
Set CORS configuration based on URL patterns.void
setLookupPathAttributeName(String lookupPathAttributeName)
Optionally configure the name of the attribute that caches the lookupPath.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 underlyingUrlPathHelper
.void
setUrlDecode(boolean urlDecode)
Shortcut to same property on underlyingUrlPathHelper
.void
setUrlPathHelper(UrlPathHelper urlPathHelper)
Set the UrlPathHelper to use for resolution of lookup paths.
构造器详细资料
UrlBasedCorsConfigurationSource
public UrlBasedCorsConfigurationSource()
方法详细资料
setPathMatcher
public void setPathMatcher(PathMatcher pathMatcher)
Set the PathMatcher implementation to use for matching URL paths against registered URL patterns. Default is AntPathMatcher.- 另请参阅:
AntPathMatcher
setAlwaysUseFullPath
public void setAlwaysUseFullPath(boolean alwaysUseFullPath)
Shortcut to same property on underlyingUrlPathHelper
.
setUrlDecode
public void setUrlDecode(boolean urlDecode)
Shortcut to same property on underlyingUrlPathHelper
.
setLookupPathAttributeName
public void setLookupPathAttributeName(@Nullable String lookupPathAttributeName)
Optionally configure the name of the attribute that caches the lookupPath. This is used to make the call toUrlPathHelper.getLookupPathForRequest(HttpServletRequest, String)
- 参数:
lookupPathAttributeName
- the request attribute to check- 从以下版本开始:
- 5.2
setRemoveSemicolonContent
public void setRemoveSemicolonContent(boolean removeSemicolonContent)
Shortcut to same property on underlyingUrlPathHelper
.
setUrlPathHelper
public void setUrlPathHelper(UrlPathHelper urlPathHelper)
Set the UrlPathHelper to use for resolution of lookup paths.Use this to override the default UrlPathHelper with a custom subclass.
setCorsConfigurations
public void setCorsConfigurations(@Nullable Map<String,CorsConfiguration> corsConfigurations)
Set CORS configuration based on URL patterns.
getCorsConfigurations
public Map<String,CorsConfiguration> getCorsConfigurations()
Get the CORS configuration.
registerCorsConfiguration
public void registerCorsConfiguration(String path, CorsConfiguration config)
Register aCorsConfiguration
for the specified path pattern.
getCorsConfiguration
@Nullable public CorsConfiguration getCorsConfiguration(HttpServletRequest request)
从接口复制的说明:CorsConfigurationSource
Return aCorsConfiguration
based on the incoming request.- 指定者:
getCorsConfiguration
在接口中CorsConfigurationSource
- 返回:
- the associated
CorsConfiguration
, ornull
if none