DestinationPatternsMessageCondition

A {@link MessageCondition} for matching the destination of a Message against one or more destination patterns using a {@link PathMatcher}.

@author Rossen Stoyanchev @since 4.0

Constructors

this
this(string[] patterns)

Creates a new instance with the given destination patterns. Each pattern that is not empty and does not start with "/" is prepended with "/". @param patterns 0 or more URL patterns; if 0 the condition will match to every request.

this
this(string[] patterns, PathMatcher pathMatcher)

Alternative constructor accepting a custom PathMatcher. @param patterns the URL patterns to use; if 0, the condition will match to every request. @param pathMatcher the PathMatcher to use

Members

Functions

combine
DestinationPatternsMessageCondition combine(DestinationPatternsMessageCondition other)

Returns a new instance with URL patterns from the current instance ("this") and the "other" instance as follows: <ul> <li>If there are patterns in both instances, combine the patterns in "this" with the patterns in "other" using {@link hunt.framework.util.PathMatcher#combine(string, string)}. <li>If only one instance has patterns, use them. <li>If neither instance has patterns, use an empty string (i.e. ""). </ul>

compareTo
int compareTo(DestinationPatternsMessageCondition other, MessageBase message)

Compare the two conditions based on the destination patterns they contain. Patterns are compared one at a time, from top to bottom via {@link hunt.framework.util.PathMatcher#getPatternComparator(string)}. If all compared patterns match equally, but one instance has more patterns, it is considered a closer match. <p>It is assumed that both instances have been obtained via {@link #getMatchingCondition(Message)} to ensure they contain only patterns that match the request and are sorted with the best matches on top.

getContent
Collection!(string) getContent()
Undocumented in source. Be warned that the author may not have intended to support it.
getMatchingCondition
DestinationPatternsMessageCondition getMatchingCondition(MessageBase message)

Check if any of the patterns match the given Message destination and return an instance that is guaranteed to contain matching patterns, sorted via {@link hunt.framework.util.PathMatcher#getPatternComparator(string)}. @param message the message to match to @return the same instance if the condition contains no patterns; or a new condition with sorted matching patterns; or {@code null} either if a destination can not be extracted or there is no match

getPatterns
Set!(string) getPatterns()
Undocumented in source. Be warned that the author may not have intended to support it.
getToStringInfix
string getToStringInfix()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

LOOKUP_DESTINATION_HEADER
enum string LOOKUP_DESTINATION_HEADER;

The name of the "lookup destination" header.

Meta