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.ObjectA base class for registeringRequestMatcher's. For example, it might allow for specifying whichRequestMatcherrequire a certain level of authorization.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description AbstractRequestMatcherRegistry()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CantMatchers(java.lang.String... antPatterns)CantMatchers(org.springframework.http.HttpMethod method)Maps aListofAntPathRequestMatcherinstances.CantMatchers(org.springframework.http.HttpMethod method, java.lang.String... antPatterns)Maps aListofAntPathRequestMatcherinstances.CanyRequest()Maps any request.protected abstract CchainRequestMatchers(java.util.List<RequestMatcher> requestMatchers)Subclasses should implement this method for returning the object that is chained to the creation of theRequestMatcherinstances.protected java.util.List<MvcRequestMatcher>createMvcMatchers(org.springframework.http.HttpMethod method, java.lang.String... mvcPatterns)CreatesMvcRequestMatcherinstances for the method and patterns passed inCdispatcherTypeMatchers(javax.servlet.DispatcherType... dispatcherTypes)CdispatcherTypeMatchers(org.springframework.http.HttpMethod method, javax.servlet.DispatcherType... dispatcherTypes)Maps aListofDispatcherTypeRequestMatcherinstances.protected org.springframework.context.ApplicationContextgetApplicationContext()Gets theApplicationContextabstract CmvcMatchers(java.lang.String... mvcPatterns)Maps anMvcRequestMatcherthat does not care whichHttpMethodis used.abstract CmvcMatchers(org.springframework.http.HttpMethod method, java.lang.String... mvcPatterns)Maps anMvcRequestMatcherthat also specifies a specificHttpMethodto match on.CregexMatchers(java.lang.String... regexPatterns)CregexMatchers(org.springframework.http.HttpMethod method, java.lang.String... regexPatterns)Maps aListofRegexRequestMatcherinstances.CrequestMatchers(RequestMatcher... requestMatchers)Associates a list ofRequestMatcherinstances with theAbstractConfigAttributeRequestMatcherRegistryprotected voidsetApplicationContext(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
public C antMatchers(org.springframework.http.HttpMethod method)
Maps aListofAntPathRequestMatcherinstances.- Parameters:
method- theHttpMethodto use for anyHttpMethod.- Returns:
- the object that is chained after creating the
RequestMatcher
-
antMatchers
public C antMatchers(org.springframework.http.HttpMethod method, java.lang.String... antPatterns)
Maps aListofAntPathRequestMatcherinstances.- Parameters:
method- theHttpMethodto use ornullfor anyHttpMethod.antPatterns- the ant patterns to create. Ifnullor empty, then matches on nothing.- Returns:
- the object that is chained after creating the
RequestMatcher
-
antMatchers
public C antMatchers(java.lang.String... antPatterns)
- Parameters:
antPatterns- the ant patterns to createAntPathRequestMatcherfrom- Returns:
- the object that is chained after creating the
RequestMatcher
-
mvcMatchers
public abstract C mvcMatchers(java.lang.String... mvcPatterns)
Maps an
MvcRequestMatcherthat does not care whichHttpMethodis 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
public abstract C mvcMatchers(org.springframework.http.HttpMethod method, java.lang.String... mvcPatterns)
Maps an
MvcRequestMatcherthat also specifies a specificHttpMethodto 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)
CreatesMvcRequestMatcherinstances 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
MvcRequestMatcherinstances
-
regexMatchers
public C regexMatchers(org.springframework.http.HttpMethod method, java.lang.String... regexPatterns)
Maps aListofRegexRequestMatcherinstances.- Parameters:
method- theHttpMethodto use ornullfor anyHttpMethod.regexPatterns- the regular expressions to createRegexRequestMatcherfrom- Returns:
- the object that is chained after creating the
RequestMatcher
-
regexMatchers
public C regexMatchers(java.lang.String... regexPatterns)
- Parameters:
regexPatterns- the regular expressions to createRegexRequestMatcherfrom- 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 aListofDispatcherTypeRequestMatcherinstances.- Parameters:
method- theHttpMethodto use ornullfor 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 ofRequestMatcherinstances with theAbstractConfigAttributeRequestMatcherRegistry- Parameters:
requestMatchers- theRequestMatcherinstances- Returns:
- the object that is chained after creating the
RequestMatcher
-
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 theRequestMatcherinstances.- Parameters:
requestMatchers- theRequestMatcherinstances that were created- Returns:
- the chained Object for the subclass which allows association of something
else to the
RequestMatcher
-
-