Class SimpDestinationMessageMatcher
- java.lang.Object
 - 
- org.springframework.security.messaging.util.matcher.SimpDestinationMessageMatcher
 
 
- 
- All Implemented Interfaces:
 MessageMatcher<java.lang.Object>
public final class SimpDestinationMessageMatcher extends java.lang.Object implements MessageMatcher<java.lang.Object>
MessageMatcher which compares a pre-defined pattern against the destination of a
Message. There is also support for optionally matching on a specifiedSimpMessageType.- Since:
 - 4.0
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static MessageMatcher<java.lang.Object>NULL_DESTINATION_MATCHER- 
Fields inherited from interface org.springframework.security.messaging.util.matcher.MessageMatcher
ANY_MESSAGE 
 - 
 
- 
Constructor Summary
Constructors Constructor Description SimpDestinationMessageMatcher(java.lang.String pattern)Creates a new instance with the specified pattern, nullSimpMessageType(matches any type), and aAntPathMatchercreated from the default constructor.SimpDestinationMessageMatcher(java.lang.String pattern, org.springframework.util.PathMatcher pathMatcher)Creates a new instance with the specified pattern andPathMatcher. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SimpDestinationMessageMatchercreateMessageMatcher(java.lang.String pattern, org.springframework.util.PathMatcher matcher)Creates a new instance with the specified pattern,SimpMessageType.MESSAGE, andPathMatcher.static SimpDestinationMessageMatchercreateSubscribeMatcher(java.lang.String pattern, org.springframework.util.PathMatcher matcher)Creates a new instance with the specified pattern,SimpMessageType.SUBSCRIBE, andPathMatcher.java.util.Map<java.lang.String,java.lang.String>extractPathVariables(org.springframework.messaging.Message<?> message)MessageMatcher<java.lang.Object>getMessageTypeMatcher()booleanmatches(org.springframework.messaging.Message<?> message)Returns true if theMessagematches, else falsejava.lang.StringtoString() 
 - 
 
- 
- 
Field Detail
- 
NULL_DESTINATION_MATCHER
public static final MessageMatcher<java.lang.Object> NULL_DESTINATION_MATCHER
 
 - 
 
- 
Constructor Detail
- 
SimpDestinationMessageMatcher
public SimpDestinationMessageMatcher(java.lang.String pattern)
Creates a new instance with the specified pattern, null
SimpMessageType(matches any type), and aAntPathMatchercreated 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- matchescom/testbut alsocom/tastorcom/txstcom/*suffix- matches all files ending insuffixin thecomdirectorycom/**/test- matches all destinations ending withtestunderneath thecompath
- Parameters:
 pattern- the pattern to use
 
- 
SimpDestinationMessageMatcher
public SimpDestinationMessageMatcher(java.lang.String pattern, org.springframework.util.PathMatcher pathMatcher)Creates a new instance with the specified pattern and
PathMatcher.- Parameters:
 pattern- the pattern to usepathMatcher- thePathMatcherto use.
 
 - 
 
- 
Method Detail
- 
matches
public boolean matches(org.springframework.messaging.Message<?> message)
Description copied from interface:MessageMatcherReturns true if theMessagematches, else false- Specified by:
 matchesin interfaceMessageMatcher<java.lang.Object>- Parameters:
 message- theMessageto match on- Returns:
 - true if the 
Messagematches, else false 
 
- 
extractPathVariables
public java.util.Map<java.lang.String,java.lang.String> extractPathVariables(org.springframework.messaging.Message<?> message)
 
- 
getMessageTypeMatcher
public MessageMatcher<java.lang.Object> getMessageTypeMatcher()
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
- 
createSubscribeMatcher
public static SimpDestinationMessageMatcher createSubscribeMatcher(java.lang.String pattern, org.springframework.util.PathMatcher matcher)
Creates a new instance with the specified pattern,
SimpMessageType.SUBSCRIBE, andPathMatcher.- Parameters:
 pattern- the pattern to usematcher- thePathMatcherto use.
 
- 
createMessageMatcher
public static SimpDestinationMessageMatcher createMessageMatcher(java.lang.String pattern, org.springframework.util.PathMatcher matcher)
Creates a new instance with the specified pattern,
SimpMessageType.MESSAGE, andPathMatcher.- Parameters:
 pattern- the pattern to usematcher- thePathMatcherto use.
 
 - 
 
 -