Class DispatcherTypeRequestMatcher

java.lang.Object
org.springframework.security.web.util.matcher.DispatcherTypeRequestMatcher
All Implemented Interfaces:
RequestMatcher

public class DispatcherTypeRequestMatcher extends Object implements 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
  • Constructor Details

    • DispatcherTypeRequestMatcher

      public DispatcherTypeRequestMatcher(jakarta.servlet.DispatcherType dispatcherType)
      Creates an instance which matches requests with the provided DispatcherType
      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 provided DispatcherType and HttpMethod
      Parameters:
      dispatcherType - the type to match against
      httpMethod - 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 interface RequestMatcher
      Parameters:
      request - the request to check for a match
      Returns:
      true if the http method and dispatcher type align
    • toString

      public String toString()
      Overrides:
      toString in class Object