Class PathPatternMessageMatcher

java.lang.Object
org.springframework.security.messaging.util.matcher.PathPatternMessageMatcher
All Implemented Interfaces:
MessageMatcher<Object>

public final class PathPatternMessageMatcher extends Object implements MessageMatcher<Object>
Match Messages based on the message destination pattern using a PathPattern. There is also support for optionally matching on a specified SimpMessageType.
Since:
6.5
  • Field Details

  • Method Details

    • withDefaults

      public static PathPatternMessageMatcher.Builder withDefaults()
      Initialize this builder with the PathPatternParser.defaultInstance that is configured with the PathContainer.Options.HTTP_PATH separator
    • withPathPatternParser

      public static PathPatternMessageMatcher.Builder withPathPatternParser(org.springframework.web.util.pattern.PathPatternParser parser)
      Initialize this builder with the provided PathPatternParser
    • matches

      public boolean matches(org.springframework.messaging.Message<?> message)
      Returns true if the Message matches, else false
      Specified by:
      matches in interface MessageMatcher<Object>
      Parameters:
      message - the Message to match on
      Returns:
      true if the Message matches, else false
    • matcher

      public MessageMatcher.MatchResult matcher(org.springframework.messaging.Message<?> message)
      Extract the path variables from the Message destination if the path is a match, otherwise the MessageMatcher.MatchResult.getVariables() returns a Collections.emptyMap()
      Specified by:
      matcher in interface MessageMatcher<Object>
      Parameters:
      message - the message whose path variables to extract.
      Returns:
      a MatchResult of the path variables and values.