public class ActionConfigMatcher extends Object implements Serializable
Matches paths against pre-compiled wildcard expressions pulled from action configs. It uses the wildcard matcher from the Apache Cocoon project. Patterns will be matched in the order they exist in the Struts config file. The last match wins, so more specific patterns should be defined after less specific patterns.
Constructor and Description |
---|
ActionConfigMatcher(ActionConfig[] configs)
Finds and precompiles the wildcard patterns from the ActionConfig
"path" attributes.
|
Modifier and Type | Method and Description |
---|---|
protected ActionConfig |
convertActionConfig(String path,
ActionConfig orig,
Map vars)
Clones the ActionConfig and its children, replacing various
properties with the values of the wildcard-matched strings.
|
protected String |
convertParam(String val,
Map vars)
Inserts into a value wildcard-matched strings where specified.
|
ActionConfig |
match(String path)
Matches the path against the compiled wildcard patterns.
|
protected void |
replaceProperties(Properties orig,
Properties props,
Map vars)
Replaces placeholders from one Properties values set to another.
|
public ActionConfigMatcher(ActionConfig[] configs)
Finds and precompiles the wildcard patterns from the ActionConfig "path" attributes. ActionConfig's will be evaluated in the order they exist in the Struts config file. Only paths that actually contain a wildcard will be compiled.
configs
- An array of ActionConfig's to processpublic ActionConfig match(String path)
Matches the path against the compiled wildcard patterns.
path
- The portion of the request URI for selecting a config.protected ActionConfig convertActionConfig(String path, ActionConfig orig, Map vars)
Clones the ActionConfig and its children, replacing various properties with the values of the wildcard-matched strings.
path
- The requested pathorig
- The original ActionConfigvars
- A Map of wildcard-matched stringsprotected void replaceProperties(Properties orig, Properties props, Map vars)
Replaces placeholders from one Properties values set to another.
orig
- The original properties set with placehold valuesprops
- The target properties to store the processed valuesvars
- A Map of wildcard-matched stringsCopyright © 2000–2016 Apache Software Foundation. All rights reserved.