Class AbstractRequestMatcherRegistry<C>
- Type Parameters:
C
- The object that is returned or Chained after creating the RequestMatcher
- Direct Known Subclasses:
AbstractConfigAttributeRequestMatcherRegistry
,AuthorizeHttpRequestsConfigurer.AuthorizationManagerRequestMatcherRegistry
,HttpSecurity.RequestMatcherConfigurer
,WebSecurity.IgnoredRequestConfigurer
RequestMatcher
's. For example, it might allow for
specifying which RequestMatcher
require a certain level of authorization.- Since:
- 3.2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionantMatchers
(String... antPatterns) antMatchers
(org.springframework.http.HttpMethod method) Maps aList
ofAntPathRequestMatcher
instances.antMatchers
(org.springframework.http.HttpMethod method, String... antPatterns) Maps aList
ofAntPathRequestMatcher
instances.Maps any request.protected abstract C
chainRequestMatchers
(List<RequestMatcher> requestMatchers) Subclasses should implement this method for returning the object that is chained to the creation of theRequestMatcher
instances.protected final List<MvcRequestMatcher>
createMvcMatchers
(org.springframework.http.HttpMethod method, String... mvcPatterns) CreatesMvcRequestMatcher
instances for the method and patterns passed indispatcherTypeMatchers
(jakarta.servlet.DispatcherType... dispatcherTypes) dispatcherTypeMatchers
(org.springframework.http.HttpMethod method, jakarta.servlet.DispatcherType... dispatcherTypes) Maps aList
ofDispatcherTypeRequestMatcher
instances.protected final org.springframework.context.ApplicationContext
Gets theApplicationContext
abstract C
mvcMatchers
(String... mvcPatterns) Maps anMvcRequestMatcher
that does not care whichHttpMethod
is used.abstract C
mvcMatchers
(org.springframework.http.HttpMethod method, String... mvcPatterns) Maps anMvcRequestMatcher
that also specifies a specificHttpMethod
to match on.regexMatchers
(String... regexPatterns) regexMatchers
(org.springframework.http.HttpMethod method, String... regexPatterns) Maps aList
ofRegexRequestMatcher
instances.requestMatchers
(RequestMatcher... requestMatchers) Associates a list ofRequestMatcher
instances with theAbstractConfigAttributeRequestMatcherRegistry
protected final void
setApplicationContext
(org.springframework.context.ApplicationContext context)
-
Constructor Details
-
AbstractRequestMatcherRegistry
public AbstractRequestMatcherRegistry()
-
-
Method Details
-
setApplicationContext
protected final void setApplicationContext(org.springframework.context.ApplicationContext context) -
getApplicationContext
protected final org.springframework.context.ApplicationContext getApplicationContext()Gets theApplicationContext
- Returns:
- the
ApplicationContext
-
anyRequest
Maps any request.- Returns:
- the object that is chained after creating the
RequestMatcher
-
antMatchers
Maps aList
ofAntPathRequestMatcher
instances.- Parameters:
method
- theHttpMethod
to use for anyHttpMethod
.- Returns:
- the object that is chained after creating the
RequestMatcher
-
antMatchers
Maps aList
ofAntPathRequestMatcher
instances.- Parameters:
method
- theHttpMethod
to use ornull
for anyHttpMethod
.antPatterns
- the ant patterns to create. Ifnull
or empty, then matches on nothing.- Returns:
- the object that is chained after creating the
RequestMatcher
-
antMatchers
- Parameters:
antPatterns
- the ant patterns to createAntPathRequestMatcher
from- Returns:
- the object that is chained after creating the
RequestMatcher
-
mvcMatchers
Maps an
MvcRequestMatcher
that does not care whichHttpMethod
is used. This matcher will use the same rules that Spring MVC uses for matching. For example, often times a mapping of the path "/path" will match on "/path", "/path/", "/path.html", etc.If the current request will not be processed by Spring MVC, a reasonable default using the pattern as a ant pattern will be used.
- Parameters:
mvcPatterns
- the patterns to match on. The rules for matching are defined by Spring MVC- Returns:
- the object that is chained after creating the
RequestMatcher
.
-
mvcMatchers
Maps an
MvcRequestMatcher
that also specifies a specificHttpMethod
to match on. This matcher will use the same rules that Spring MVC uses for matching. For example, often times a mapping of the path "/path" will match on "/path", "/path/", "/path.html", etc.If the current request will not be processed by Spring MVC, a reasonable default using the pattern as a ant pattern will be used.
- Parameters:
method
- the HTTP method to match onmvcPatterns
- the patterns to match on. The rules for matching are defined by Spring MVC- Returns:
- the object that is chained after creating the
RequestMatcher
.
-
createMvcMatchers
protected final List<MvcRequestMatcher> createMvcMatchers(org.springframework.http.HttpMethod method, String... mvcPatterns) CreatesMvcRequestMatcher
instances for the method and patterns passed in- Parameters:
method
- the HTTP method to use or null if any should be usedmvcPatterns
- the Spring MVC patterns to match on- Returns:
- a List of
MvcRequestMatcher
instances
-
regexMatchers
Maps aList
ofRegexRequestMatcher
instances.- Parameters:
method
- theHttpMethod
to use ornull
for anyHttpMethod
.regexPatterns
- the regular expressions to createRegexRequestMatcher
from- Returns:
- the object that is chained after creating the
RequestMatcher
-
regexMatchers
- Parameters:
regexPatterns
- the regular expressions to createRegexRequestMatcher
from- Returns:
- the object that is chained after creating the
RequestMatcher
-
dispatcherTypeMatchers
public C dispatcherTypeMatchers(@Nullable org.springframework.http.HttpMethod method, jakarta.servlet.DispatcherType... dispatcherTypes) Maps aList
ofDispatcherTypeRequestMatcher
instances.- Parameters:
method
- theHttpMethod
to use ornull
for anyHttpMethod
.dispatcherTypes
- the dispatcher types to match against- Returns:
- the object that is chained after creating the
RequestMatcher
-
dispatcherTypeMatchers
- Parameters:
dispatcherTypes
- the dispatcher types to match against- Returns:
- the object that is chained after creating the
RequestMatcher
-
requestMatchers
Associates a list ofRequestMatcher
instances with theAbstractConfigAttributeRequestMatcherRegistry
- Parameters:
requestMatchers
- theRequestMatcher
instances- Returns:
- the object that is chained after creating the
RequestMatcher
-
chainRequestMatchers
Subclasses should implement this method for returning the object that is chained to the creation of theRequestMatcher
instances.- Parameters:
requestMatchers
- theRequestMatcher
instances that were created- Returns:
- the chained Object for the subclass which allows association of something
else to the
RequestMatcher
-