org.apache.struts.config

Class ActionConfigMatcher

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.

Since: Struts 1.2

Nested Class Summary
classActionConfigMatcher.Mapping
Stores a compiled wildcard pattern and the ActionConfig it came from.
Field Summary
ListcompiledPaths
The compiled paths and their associated ActionConfig's
static Loglog
The logging instance
static WildcardHelperwildcard
Handles all wildcard pattern matching.
Constructor Summary
ActionConfigMatcher(ActionConfig[] configs)
Finds and precompiles the wildcard patterns from the ActionConfig "path" attributes.
Method Summary
protected ActionConfigconvertActionConfig(String path, ActionConfig orig, Map vars)
Clones the ActionConfig and its children, replacing various properties with the values of the wildcard-matched strings.
protected StringconvertParam(String val, Map vars)
Inserts into a value wildcard-matched strings where specified.
ActionConfigmatch(String path)
Matches the path against the compiled wildcard patterns.

Field Detail

compiledPaths

private List compiledPaths
The compiled paths and their associated ActionConfig's

log

private static final Log log
The logging instance

wildcard

private static final WildcardHelper wildcard
Handles all wildcard pattern matching.

Constructor Detail

ActionConfigMatcher

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.

Parameters: configs An array of ActionConfig's to process

Method Detail

convertActionConfig

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.

Parameters: path The requested path orig The original ActionConfig vars A Map of wildcard-matched strings

Returns: A cloned ActionConfig with appropriate properties replaced with wildcard-matched values

convertParam

protected String convertParam(String val, Map vars)
Inserts into a value wildcard-matched strings where specified.

Parameters: val The value to convert vars A Map of wildcard-matched strings

Returns: The new value

match

public ActionConfig match(String path)
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

Copyright B) 2000-2009 - The Apache Software Foundation