Class AbstractMatcher<E>
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- ActionConfigMatcher,- NamespaceMatcher
Matches patterns against pre-compiled wildcard expressions pulled from target objects. It uses the wildcard matcher from the Apache Cocoon project. Patterns will be matched in the order they were added. The first match wins, so more specific patterns should be defined before less specific patterns.
- Since:
- 2.1
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddPattern(String name, E target, boolean looseMatch) Finds and precompiles the wildcard patterns.protected abstract EClones the target object and its children, replacing various properties with the values of the wildcard-matched strings.protected StringconvertParam(String val, Map<String, String> vars) Inserts into a value wildcard-matched strings where specified with the {x} syntax.voidfreeze()Matches the path against the compiled wildcard patterns.Replaces parameter values
- 
Constructor Details- 
AbstractMatcher
 
- 
- 
Method Details- 
addPatternFinds and precompiles the wildcard patterns. Patterns will be evaluated in the order they were added. Only patterns that actually contain a wildcard will be compiled. Patterns can optionally be matched "loosely". When the end of the pattern matches \*[^*]\*$ (wildcard, no wildcard, wildcard), if the pattern fails, it is also matched as if the last two characters didn't exist. The goal is to support the legacy "*!*" syntax, where the "!*" is optional. - Parameters:
- name- The pattern
- target- The object to associate with the pattern
- looseMatch- To loosely match wildcards or not
 
- 
freezepublic void freeze()
- 
matchMatches the path against the compiled wildcard patterns. - Parameters:
- potentialMatch- The portion of the request URI for selecting a config.
- Returns:
- The action config if matched, else null
 
- 
convertClones the target object and its children, replacing various properties with the values of the wildcard-matched strings. - Parameters:
- path- The requested path
- orig- The original object
- vars- A Map of wildcard-matched strings
- Returns:
- A cloned object with appropriate properties replaced with wildcard-matched values
 
- 
replaceParametersReplaces parameter values - Parameters:
- orig- The original parameters with placeholder values
- vars- A Map of wildcard-matched strings
- Returns:
- map with replaced parameters
 
- 
convertParamInserts into a value wildcard-matched strings where specified with the {x} syntax. If a wildcard-matched value isn't found, the replacement token is turned into an empty string. - Parameters:
- val- The value to convert
- vars- A Map of wildcard-matched strings
- Returns:
- The new value
 
 
-