Class NamedVariablePatternMatcher

java.lang.Object
org.apache.struts2.util.NamedVariablePatternMatcher
All Implemented Interfaces:
PatternMatcher<NamedVariablePatternMatcher.CompiledPattern>

public class NamedVariablePatternMatcher extends Object implements PatternMatcher<NamedVariablePatternMatcher.CompiledPattern>
An implementation of a pattern matcher that uses simple named wildcards. The named wildcards are defined using the {VARIABLE_NAME} syntax and will match any characters that aren't '/'. Internally, the pattern is converted into a regular expression where the named wildcard will be translated into ([^/]+) so that at least one character must match in order for the wildcard to be matched successfully. Matched values will be available in the variable map, indexed by the name they were given in the pattern.

For example, the following patterns will be processed as so:

Pattern Example Variable Map Contents
/animals/{animal} /animals/dog {animal -> dog}
/animals/{animal}/tag/No{id} /animals/dog/tag/No23 {animal -> dog, id -> 23}
/{language} /en {language -> en}

Escaping hasn't been implemented since the intended use of these patterns will be in matching URLs.

Since:
2.1