C
- the type of the context that the match method actually needs to use. Can be
an ApplicationContext
or a class of an existing bean
.public abstract class ApplicationContextRequestMatcher<C>
extends java.lang.Object
implements org.springframework.security.web.util.matcher.RequestMatcher
ApplicationContext
backed RequestMatcher
. Can work directly with the
ApplicationContext
, obtain an existing bean or
create a new bean
that is autowired in the usual way.Constructor and Description |
---|
ApplicationContextRequestMatcher(java.lang.Class<? extends C> contextClass) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
ignoreApplicationContext(org.springframework.web.context.WebApplicationContext webApplicationContext)
Returns if the
WebApplicationContext should be ignored and not used for
matching. |
protected void |
initialized(java.util.function.Supplier<C> context)
Method that can be implemented by subclasses that wish to initialize items the
first time that the matcher is called.
|
boolean |
matches(javax.servlet.http.HttpServletRequest request) |
protected abstract boolean |
matches(javax.servlet.http.HttpServletRequest request,
java.util.function.Supplier<C> context)
Decides whether the rule implemented by the strategy matches the supplied request.
|
public ApplicationContextRequestMatcher(java.lang.Class<? extends C> contextClass)
public final boolean matches(javax.servlet.http.HttpServletRequest request)
matches
in interface org.springframework.security.web.util.matcher.RequestMatcher
protected boolean ignoreApplicationContext(org.springframework.web.context.WebApplicationContext webApplicationContext)
WebApplicationContext
should be ignored and not used for
matching. If this method returns true
then the context will not be used and
the matches
method will return false
.webApplicationContext
- the candidate web application contextprotected void initialized(java.util.function.Supplier<C> context)
ignoreApplicationContext(WebApplicationContext)
returns
false
. Note that the supplied context will be based on the
first request sent to the matcher.context
- a supplier for the initialized context (may throw an exception)ignoreApplicationContext(WebApplicationContext)
protected abstract boolean matches(javax.servlet.http.HttpServletRequest request, java.util.function.Supplier<C> context)
request
- the source requestcontext
- a supplier for the initialized context (may throw an exception)