Class SimpDestinationMessageMatcher

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

public final class SimpDestinationMessageMatcher extends Object implements MessageMatcher<Object>

MessageMatcher which compares a pre-defined pattern against the destination of a Message. There is also support for optionally matching on a specified SimpMessageType.

Since:
4.0
  • Field Details

  • Constructor Details

    • SimpDestinationMessageMatcher

      public SimpDestinationMessageMatcher(String pattern)

      Creates a new instance with the specified pattern, null SimpMessageType (matches any type), and a AntPathMatcher created from the default constructor.

      The mapping matches destinations despite the using the following rules:

      • ? matches one character
      • * matches zero or more characters
      • ** matches zero or more 'directories' in a path

      Some examples:

      • com/t?st.jsp - matches com/test but also com/tast or com/txst
      • com/*suffix - matches all files ending in suffix in the com directory
      • com/&#42;&#42;/test - matches all destinations ending with test underneath the com path
      Parameters:
      pattern - the pattern to use
    • SimpDestinationMessageMatcher

      public SimpDestinationMessageMatcher(String pattern, org.springframework.util.PathMatcher pathMatcher)

      Creates a new instance with the specified pattern and PathMatcher.

      Parameters:
      pattern - the pattern to use
      pathMatcher - the PathMatcher to use.
  • Method Details

    • matches

      public boolean matches(org.springframework.messaging.Message<?> message)
      Description copied from interface: MessageMatcher
      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
    • extractPathVariables

      public Map<String,String> extractPathVariables(org.springframework.messaging.Message<?> message)
    • getMessageTypeMatcher

      public MessageMatcher<Object> getMessageTypeMatcher()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createSubscribeMatcher

      public static SimpDestinationMessageMatcher createSubscribeMatcher(String pattern, org.springframework.util.PathMatcher matcher)

      Creates a new instance with the specified pattern, SimpMessageType.SUBSCRIBE, and PathMatcher.

      Parameters:
      pattern - the pattern to use
      matcher - the PathMatcher to use.
    • createMessageMatcher

      public static SimpDestinationMessageMatcher createMessageMatcher(String pattern, org.springframework.util.PathMatcher matcher)

      Creates a new instance with the specified pattern, SimpMessageType.MESSAGE, and PathMatcher.

      Parameters:
      pattern - the pattern to use
      matcher - the PathMatcher to use.