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.
| Modifier and Type | Field and Description |
|---|---|
static MessageMatcher<Object> |
NULL_DESTINATION_MATCHER |
ANY_MESSAGE| Constructor and Description |
|---|
SimpDestinationMessageMatcher(String pattern)
Creates a new instance with the specified pattern, null
SimpMessageType
(matches any type), and a AntPathMatcher created from the default
constructor. |
SimpDestinationMessageMatcher(String pattern,
PathMatcher pathMatcher)
Creates a new instance with the specified pattern and
PathMatcher. |
| Modifier and Type | Method and Description |
|---|---|
static SimpDestinationMessageMatcher |
createMessageMatcher(String pattern,
PathMatcher matcher)
Creates a new instance with the specified pattern,
SimpMessageType.MESSAGE,
and PathMatcher. |
static SimpDestinationMessageMatcher |
createSubscribeMatcher(String pattern,
PathMatcher matcher)
Creates a new instance with the specified pattern,
SimpMessageType.SUBSCRIBE, and PathMatcher. |
MessageMatcher<Object> |
getMessageTypeMatcher() |
boolean |
matches(org.springframework.messaging.Message<? extends Object> message)
Returns true if the
Message matches, else false |
String |
toString() |
public static final MessageMatcher<Object> NULL_DESTINATION_MATCHER
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:
Some examples:
com/t?st.jsp - matches com/test but also com/tast or
com/txstcom/*suffix - matches all files ending in suffix in the
com directorycom/**/test - matches all destinations ending with test
underneath the com pathpattern - the pattern to usepublic SimpDestinationMessageMatcher(String pattern, PathMatcher pathMatcher)
Creates a new instance with the specified pattern and PathMatcher.
pattern - the pattern to usepathMatcher - the PathMatcher to use.public boolean matches(org.springframework.messaging.Message<? extends Object> message)
MessageMatcherMessage matches, else falsematches in interface MessageMatcher<Object>message - the Message to match onMessage matches, else falsepublic MessageMatcher<Object> getMessageTypeMatcher()
public static SimpDestinationMessageMatcher createSubscribeMatcher(String pattern, PathMatcher matcher)
Creates a new instance with the specified pattern,
SimpMessageType.SUBSCRIBE, and PathMatcher.
pattern - the pattern to usematcher - the PathMatcher to use.public static SimpDestinationMessageMatcher createMessageMatcher(String pattern, PathMatcher matcher)
Creates a new instance with the specified pattern, SimpMessageType.MESSAGE,
and PathMatcher.
pattern - the pattern to usematcher - the PathMatcher to use.