Class AbstractRequestMatcherRegistry<C>
- java.lang.Object
-
- org.springframework.security.config.annotation.web.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
public abstract class AbstractRequestMatcherRegistry<C> extends java.lang.Object
A base class for registeringRequestMatcher
's. For example, it might allow for specifying whichRequestMatcher
require a certain level of authorization.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description AbstractRequestMatcherRegistry()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description C
antMatchers(java.lang.String... antPatterns)
Deprecated.userequestMatchers(String...)
insteadC
antMatchers(org.springframework.http.HttpMethod method)
Deprecated.userequestMatchers(HttpMethod)
insteadC
antMatchers(org.springframework.http.HttpMethod method, java.lang.String... antPatterns)
Deprecated.userequestMatchers(HttpMethod, String...)
insteadC
anyRequest()
Maps any request.protected abstract C
chainRequestMatchers(java.util.List<RequestMatcher> requestMatchers)
Subclasses should implement this method for returning the object that is chained to the creation of theRequestMatcher
instances.protected java.util.List<MvcRequestMatcher>
createMvcMatchers(org.springframework.http.HttpMethod method, java.lang.String... mvcPatterns)
CreatesMvcRequestMatcher
instances for the method and patterns passed inC
dispatcherTypeMatchers(javax.servlet.DispatcherType... dispatcherTypes)
C
dispatcherTypeMatchers(org.springframework.http.HttpMethod method, javax.servlet.DispatcherType... dispatcherTypes)
Maps aList
ofDispatcherTypeRequestMatcher
instances.protected org.springframework.context.ApplicationContext
getApplicationContext()
Gets theApplicationContext
abstract C
mvcMatchers(java.lang.String... mvcPatterns)
Deprecated.userequestMatchers(String...)
insteadabstract C
mvcMatchers(org.springframework.http.HttpMethod method, java.lang.String... mvcPatterns)
Deprecated.userequestMatchers(HttpMethod, String...)
insteadC
regexMatchers(java.lang.String... regexPatterns)
Deprecated.userequestMatchers(RequestMatcher...)
with aRegexRequestMatcher
insteadC
regexMatchers(org.springframework.http.HttpMethod method, java.lang.String... regexPatterns)
Deprecated.userequestMatchers(RequestMatcher...)
with aRegexRequestMatcher
insteadC
requestMatchers(java.lang.String... patterns)
If theHandlerMappingIntrospector
is available in the classpath, maps to anMvcRequestMatcher
that does not care whichHttpMethod
is used.C
requestMatchers(org.springframework.http.HttpMethod method)
If theHandlerMappingIntrospector
is available in the classpath, maps to anMvcRequestMatcher
that matches on a specificHttpMethod
.C
requestMatchers(org.springframework.http.HttpMethod method, java.lang.String... patterns)
If theHandlerMappingIntrospector
is available in the classpath, maps to anMvcRequestMatcher
that also specifies a specificHttpMethod
to match on.C
requestMatchers(RequestMatcher... requestMatchers)
Associates a list ofRequestMatcher
instances with theAbstractConfigAttributeRequestMatcherRegistry
protected void
setApplicationContext(org.springframework.context.ApplicationContext context)
-
-
-
Method Detail
-
setApplicationContext
protected final void setApplicationContext(org.springframework.context.ApplicationContext context)
-
getApplicationContext
protected final org.springframework.context.ApplicationContext getApplicationContext()
Gets theApplicationContext
- Returns:
- the
ApplicationContext
-
anyRequest
public C anyRequest()
Maps any request.- Returns:
- the object that is chained after creating the
RequestMatcher
-
antMatchers
@Deprecated public C antMatchers(org.springframework.http.HttpMethod method)
Deprecated.userequestMatchers(HttpMethod)
insteadMaps aList
ofAntPathRequestMatcher
instances.- Parameters:
method
- theHttpMethod
to use for anyHttpMethod
.- Returns:
- the object that is chained after creating the
RequestMatcher
-
antMatchers
@Deprecated public C antMatchers(org.springframework.http.HttpMethod method, java.lang.String... antPatterns)
Deprecated.userequestMatchers(HttpMethod, String...)
insteadMaps 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
@Deprecated public C antMatchers(java.lang.String... antPatterns)
Deprecated.userequestMatchers(String...)
instead- Parameters:
antPatterns
- the ant patterns to createAntPathRequestMatcher
from- Returns:
- the object that is chained after creating the
RequestMatcher
-
mvcMatchers
@Deprecated public abstract C mvcMatchers(java.lang.String... mvcPatterns)
Deprecated.userequestMatchers(String...)
insteadMaps 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
@Deprecated public abstract C mvcMatchers(org.springframework.http.HttpMethod method, java.lang.String... mvcPatterns)
Deprecated.userequestMatchers(HttpMethod, String...)
insteadMaps 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 java.util.List<MvcRequestMatcher> createMvcMatchers(org.springframework.http.HttpMethod method, java.lang.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
@Deprecated public C regexMatchers(org.springframework.http.HttpMethod method, java.lang.String... regexPatterns)
Deprecated.userequestMatchers(RequestMatcher...)
with aRegexRequestMatcher
insteadMaps 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
@Deprecated public C regexMatchers(java.lang.String... regexPatterns)
Deprecated.userequestMatchers(RequestMatcher...)
with aRegexRequestMatcher
instead- 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, javax.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
public C dispatcherTypeMatchers(javax.servlet.DispatcherType... dispatcherTypes)
- Parameters:
dispatcherTypes
- the dispatcher types to match against- Returns:
- the object that is chained after creating the
RequestMatcher
-
requestMatchers
public C requestMatchers(RequestMatcher... requestMatchers)
Associates a list ofRequestMatcher
instances with theAbstractConfigAttributeRequestMatcherRegistry
- Parameters:
requestMatchers
- theRequestMatcher
instances- Returns:
- the object that is chained after creating the
RequestMatcher
-
requestMatchers
public C requestMatchers(org.springframework.http.HttpMethod method, java.lang.String... patterns)
If the
HandlerMappingIntrospector
is available in the classpath, maps to anMvcRequestMatcher
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 theHandlerMappingIntrospector
is not available, maps to anAntPathRequestMatcher
.If a specific
RequestMatcher
must be specified, userequestMatchers(RequestMatcher...)
instead- Parameters:
method
- theHttpMethod
to use ornull
for anyHttpMethod
.patterns
- the patterns to match on. The rules for matching are defined by Spring MVC ifMvcRequestMatcher
is used- Returns:
- the object that is chained after creating the
RequestMatcher
. - Since:
- 5.8
-
requestMatchers
public C requestMatchers(java.lang.String... patterns)
If the
HandlerMappingIntrospector
is available in the classpath, maps to anMvcRequestMatcher
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 theHandlerMappingIntrospector
is not available, maps to anAntPathRequestMatcher
.If a specific
RequestMatcher
must be specified, userequestMatchers(RequestMatcher...)
instead- Parameters:
patterns
- the patterns to match on. The rules for matching are defined by Spring MVC ifMvcRequestMatcher
is used- Returns:
- the object that is chained after creating the
RequestMatcher
. - Since:
- 5.8
-
requestMatchers
public C requestMatchers(org.springframework.http.HttpMethod method)
If the
HandlerMappingIntrospector
is available in the classpath, maps to anMvcRequestMatcher
that matches on a specificHttpMethod
. 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 theHandlerMappingIntrospector
is not available, maps to anAntPathRequestMatcher
.If a specific
RequestMatcher
must be specified, userequestMatchers(RequestMatcher...)
instead- Parameters:
method
- theHttpMethod
to use ornull
for anyHttpMethod
.- Returns:
- the object that is chained after creating the
RequestMatcher
. - Since:
- 5.8
-
chainRequestMatchers
protected abstract C chainRequestMatchers(java.util.List<RequestMatcher> requestMatchers)
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
-
-