Class DispatcherTypeRequestMatcher
java.lang.Object
org.springframework.security.web.util.matcher.DispatcherTypeRequestMatcher
- All Implemented Interfaces:
RequestMatcher
Checks the
DispatcherType
to decide whether to match a given request.
HttpServletRequest
.
Can also be configured to match a specific HTTP method.- Since:
- 5.5
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.security.web.util.matcher.RequestMatcher
RequestMatcher.MatchResult
-
Constructor Summary
ConstructorDescriptionDispatcherTypeRequestMatcher
(jakarta.servlet.DispatcherType dispatcherType) Creates an instance which matches requests with the providedDispatcherType
DispatcherTypeRequestMatcher
(jakarta.servlet.DispatcherType dispatcherType, org.springframework.http.HttpMethod httpMethod) Creates an instance which matches requests with the providedDispatcherType
andHttpMethod
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.security.web.util.matcher.RequestMatcher
matcher
-
Constructor Details
-
DispatcherTypeRequestMatcher
public DispatcherTypeRequestMatcher(jakarta.servlet.DispatcherType dispatcherType) Creates an instance which matches requests with the providedDispatcherType
- Parameters:
dispatcherType
- the type to match against
-
DispatcherTypeRequestMatcher
public DispatcherTypeRequestMatcher(jakarta.servlet.DispatcherType dispatcherType, @Nullable org.springframework.http.HttpMethod httpMethod) Creates an instance which matches requests with the providedDispatcherType
andHttpMethod
- Parameters:
dispatcherType
- the type to match againsthttpMethod
- the HTTP method to match. May be null to match all methods.
-
-
Method Details
-
matches
public boolean matches(jakarta.servlet.http.HttpServletRequest request) Performs the match against the request's method and dispatcher type.- Specified by:
matches
in interfaceRequestMatcher
- Parameters:
request
- the request to check for a match- Returns:
- true if the http method and dispatcher type align
-
toString
-