Class ActionConfigMatcher
- All Implemented Interfaces:
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.
- Since:
- Struts 1.2
- See Also:
-
Constructor Summary
ConstructorDescriptionActionConfigMatcher
(ActionConfig[] configs) Finds and precompiles the wildcard patterns from the ActionConfig "path" attributes. -
Method Summary
Modifier and TypeMethodDescriptionprotected ActionConfig
convertActionConfig
(String path, ActionConfig orig, Map<String, String> vars) Clones the ActionConfig and its children, replacing various properties with the values of the wildcard-matched strings.protected String
convertParam
(String val, Map<String, String> vars) Inserts into a value wildcard-matched strings where specified.Matches the path against the compiled wildcard patterns.protected void
replaceProperties
(Properties orig, Properties props, Map<String, String> vars) Replaces placeholders from one Properties values set to another.
-
Constructor Details
-
ActionConfigMatcher
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.
- Parameters:
configs
- An array of ActionConfig's to process
-
-
Method Details
-
match
Matches the path against the compiled wildcard patterns.
- Parameters:
path
- The portion of the request URI for selecting a config.- Returns:
- The action config if matched, else null
-
convertActionConfig
Clones the ActionConfig and its children, replacing various properties with the values of the wildcard-matched strings.
- Parameters:
path
- The requested pathorig
- The original ActionConfigvars
- A Map of wildcard-matched strings- Returns:
- A cloned ActionConfig with appropriate properties replaced with wildcard-matched values
- Throws:
IllegalStateException
- if a placeholder substitution is impossible due to recursion
-
replaceProperties
Replaces placeholders from one Properties values set to another.
- Parameters:
orig
- The original properties set with placehold valuesprops
- The target properties to store the processed valuesvars
- A Map of wildcard-matched strings- Throws:
IllegalStateException
- if a placeholder substitution is impossible due to recursion
-
convertParam
Inserts into a value wildcard-matched strings where specified.
- Parameters:
val
- The value to convertvars
- A Map of wildcard-matched strings- Returns:
- The new value
- Throws:
IllegalStateException
- if a placeholder substitution is impossible due to recursion
-