类 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)
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(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.
构造器详细资料
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)
Set if URL lookup should always use the full path within the current servlet context. Else, the path within the current servlet mapping is used if applicable (that is, in the case of a ".../*" servlet mapping in web.xml).Default is "false".
setUrlDecode
public void setUrlDecode(boolean urlDecode)
Set if context path and request URI should be URL-decoded. Both are returned undecoded by the Servlet API, in contrast to the servlet path.Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).
setRemoveSemicolonContent
public void setRemoveSemicolonContent(boolean removeSemicolonContent)
Set if ";" (semicolon) content should be stripped from the request URI.The default value is
true
.
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(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
public CorsConfiguration getCorsConfiguration(HttpServletRequest request)
从接口复制的说明:CorsConfigurationSource
Return aCorsConfiguration
based on the incoming request.- 指定者:
getCorsConfiguration
在接口中CorsConfigurationSource
- 返回:
- the associated
CorsConfiguration
, ornull
if none