Package 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" />
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncompilePattern(String data) Translate the givenStringinto an object representing the pattern matchable by this class.booleanDetermines if the pattern is a simple literal string or contains wildcards that will need to be processedbooleanMatch a pattern against a string
- 
Constructor Details- 
RegexPatternMatcherpublic RegexPatternMatcher()
 
- 
- 
Method Details- 
compilePatternDescription copied from interface:PatternMatcherTranslate the given Stringinto an object representing the pattern matchable by this class.- Specified by:
- compilePatternin interface- PatternMatcher<RegexPatternMatcherExpression>
- Parameters:
- data- The string to translate.
- Returns:
- The encoded string
 
- 
isLiteralDescription copied from interface:PatternMatcherDetermines if the pattern is a simple literal string or contains wildcards that will need to be processed- Specified by:
- isLiteralin interface- PatternMatcher<RegexPatternMatcherExpression>
- Parameters:
- pattern- The string pattern
- Returns:
- True if the pattern doesn't contain processing elements, false otherwise
 
- 
matchDescription copied from interface:PatternMatcherMatch a pattern against a string- Specified by:
- matchin interface- PatternMatcher<RegexPatternMatcherExpression>
- Parameters:
- map- The map to store matched values
- data- The string to match
- expr- The compiled wildcard expression
- Returns:
- True if a match
 
 
-