org.apache.struts2.util
Class RegexPatternMatcher
java.lang.Object
org.apache.struts2.util.RegexPatternMatcher
- All Implemented Interfaces:
- PatternMatcher<RegexPatternMatcherExpression>
public class RegexPatternMatcher
- extends Object
- implements PatternMatcher<RegexPatternMatcherExpression>
Allows regular expressions to be used in action names. The regular expressions
can be in the form {FIELD_NAME} or {FIELD_NAME:REGULAR_EXPRESSION}. For example:
<action name="/{bio:.+}/test/{name}" class="org.apache.struts2.showcase.UITagExample">
<result>/tags/ui/example.jsp</result>
</action>
For this to work it is important to set the following:
<constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
<constant name="struts.patternMatcher" value="regex" />
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RegexPatternMatcher
public RegexPatternMatcher()
compilePattern
public RegexPatternMatcherExpression compilePattern(String data)
- Specified by:
compilePattern
in interface PatternMatcher<RegexPatternMatcherExpression>
isLiteral
public boolean isLiteral(String pattern)
- Specified by:
isLiteral
in interface PatternMatcher<RegexPatternMatcherExpression>
match
public boolean match(Map<String,String> map,
String data,
RegexPatternMatcherExpression expr)
- Specified by:
match
in interface PatternMatcher<RegexPatternMatcherExpression>
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.