Class AntPathRequestMatcher
java.lang.Object
org.springframework.security.web.util.matcher.AntPathRequestMatcher
- All Implemented Interfaces:
RequestMatcher
,RequestVariablesExtractor
@Deprecated(forRemoval=true)
public final class AntPathRequestMatcher
extends Object
implements RequestMatcher, RequestVariablesExtractor
Deprecated, for removal: This API element is subject to removal in a future version.
Matcher which compares a pre-defined ant-style pattern against the URL (
servletPath + pathInfo
) of an HttpServletRequest
. The query string of
the URL is ignored and matching is case-insensitive or case-sensitive depending on the
arguments passed into the constructor.
Using a pattern value of /**
or **
is treated as a universal match,
which will match any request. Patterns which end with /**
(and have no other
wildcards) are optimized by using a substring match — a pattern of
/aaa/**
will match /aaa
, /aaa/
and any sub-directories, such as
/aaa/bbb/ccc
.
For all other cases, Spring's AntPathMatcher
is used to perform the match. See
the Spring documentation for this class for comprehensive information on the syntax
used.
- Since:
- 3.1
- See Also:
-
AntPathMatcher
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.security.web.util.matcher.RequestMatcher
RequestMatcher.MatchResult
-
Constructor Summary
ConstructorsConstructorDescriptionAntPathRequestMatcher
(String pattern) Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the specific pattern which will match all HTTP methods in a case sensitive manner.AntPathRequestMatcher
(String pattern, String httpMethod) Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the supplied pattern and HTTP method in a case sensitive manner.AntPathRequestMatcher
(String pattern, String httpMethod, boolean caseSensitive) Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the supplied pattern which will match the specified Http methodAntPathRequestMatcher
(String pattern, String httpMethod, boolean caseSensitive, org.springframework.web.util.UrlPathHelper urlPathHelper) Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the supplied pattern which will match the specified Http method -
Method Summary
Modifier and TypeMethodDescriptionstatic AntPathRequestMatcher
antMatcher
(String pattern) Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the specific pattern which will match all HTTP methods in a case-sensitive manner.static AntPathRequestMatcher
antMatcher
(org.springframework.http.HttpMethod method) Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher that will match all request with the supplied HTTP method in a case-sensitive manner.static AntPathRequestMatcher
antMatcher
(org.springframework.http.HttpMethod method, String pattern) Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the supplied pattern and HTTP method in a case-sensitive manner.boolean
Deprecated, for removal: This API element is subject to removal in a future version.extractUriTemplateVariables
(jakarta.servlet.http.HttpServletRequest request) Deprecated.Deprecated, for removal: This API element is subject to removal in a future version.int
hashCode()
Deprecated, for removal: This API element is subject to removal in a future version.matcher
(jakarta.servlet.http.HttpServletRequest request) Deprecated, for removal: This API element is subject to removal in a future version.Returns a MatchResult for this RequestMatcher The default implementation returnsCollections.emptyMap()
whenRequestMatcher.MatchResult.getVariables()
is invoked.boolean
matches
(jakarta.servlet.http.HttpServletRequest request) Deprecated, for removal: This API element is subject to removal in a future version.Returns true if the configured pattern (and HTTP-Method) match those of the supplied request.toString()
Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
AntPathRequestMatcher
Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the specific pattern which will match all HTTP methods in a case sensitive manner.- Parameters:
pattern
- the ant pattern to use for matching
-
AntPathRequestMatcher
Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the supplied pattern and HTTP method in a case sensitive manner.- Parameters:
pattern
- the ant pattern to use for matchinghttpMethod
- the HTTP method. Thematches
method will return false if the incoming request doesn't have the same method.
-
AntPathRequestMatcher
Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the supplied pattern which will match the specified Http method- Parameters:
pattern
- the ant pattern to use for matchinghttpMethod
- the HTTP method. Thematches
method will return false if the incoming request doesn't doesn't have the same method.caseSensitive
- true if the matcher should consider case, else false
-
AntPathRequestMatcher
public AntPathRequestMatcher(String pattern, String httpMethod, boolean caseSensitive, org.springframework.web.util.UrlPathHelper urlPathHelper) Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the supplied pattern which will match the specified Http method- Parameters:
pattern
- the ant pattern to use for matchinghttpMethod
- the HTTP method. Thematches
method will return false if the incoming request doesn't have the same method.caseSensitive
- true if the matcher should consider case, else falseurlPathHelper
- if non-null, will be used for extracting the path from the HttpServletRequest
-
-
Method Details
-
antMatcher
Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the specific pattern which will match all HTTP methods in a case-sensitive manner.- Parameters:
pattern
- the ant pattern to use for matching- Since:
- 5.8
-
antMatcher
Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher that will match all request with the supplied HTTP method in a case-sensitive manner.- Parameters:
method
- the HTTP method. Thematches
method will return false if the incoming request doesn't have the same method.- Since:
- 5.8
-
antMatcher
public static AntPathRequestMatcher antMatcher(org.springframework.http.HttpMethod method, String pattern) Deprecated, for removal: This API element is subject to removal in a future version.Creates a matcher with the supplied pattern and HTTP method in a case-sensitive manner.- Parameters:
method
- the HTTP method. Thematches
method will return false if the incoming request doesn't have the same method.pattern
- the ant pattern to use for matching- Since:
- 5.8
-
matches
public boolean matches(jakarta.servlet.http.HttpServletRequest request) Deprecated, for removal: This API element is subject to removal in a future version.Returns true if the configured pattern (and HTTP-Method) match those of the supplied request.- Specified by:
matches
in interfaceRequestMatcher
- Parameters:
request
- the request to match against. The ant pattern will be matched against theservletPath
+pathInfo
of the request.- Returns:
- true if the request matches, false otherwise
-
extractUriTemplateVariables
@Deprecated public Map<String,String> extractUriTemplateVariables(jakarta.servlet.http.HttpServletRequest request) Deprecated.Description copied from interface:RequestVariablesExtractor
Extract URL template variables from the request.- Specified by:
extractUriTemplateVariables
in interfaceRequestVariablesExtractor
- Parameters:
request
- the HttpServletRequest to obtain a URL to extract the variables from- Returns:
- the URL variables or empty if no variables are found
-
matcher
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:RequestMatcher
Returns a MatchResult for this RequestMatcher The default implementation returnsCollections.emptyMap()
whenRequestMatcher.MatchResult.getVariables()
is invoked.- Specified by:
matcher
in interfaceRequestMatcher
- Returns:
- the MatchResult from comparing this RequestMatcher against the HttpServletRequest
-
getPattern
Deprecated, for removal: This API element is subject to removal in a future version. -
equals
Deprecated, for removal: This API element is subject to removal in a future version. -
hashCode
public int hashCode()Deprecated, for removal: This API element is subject to removal in a future version. -
toString
Deprecated, for removal: This API element is subject to removal in a future version.
-
PathPatternRequestMatcher
instead