com.oroad.stxx.plugin
Class ActionMappingMatcher

java.lang.Object
  extended bycom.oroad.stxx.plugin.ActionMappingMatcher

public class ActionMappingMatcher
extends java.lang.Object

Matches paths against pre-compiled wildcard expressions pulled from action mappings. It uses the wildcard matcher from the Apache Cocoon project. Copied from the Struts-wildcard project.

Author:
Don Brown

Field Summary
protected  java.util.List compiledPaths
          The compiled paths and their associated ActionMapping's
protected static org.apache.commons.logging.Log log
          The logging instance
 
Constructor Summary
ActionMappingMatcher(org.apache.struts.config.ModuleConfig appConfig)
          Finds and precompiles the wildcard patterns from the ActionMapping "path" attributes.
 
Method Summary
protected  org.apache.struts.action.ActionMapping convertActionMapping(java.lang.String path, org.apache.struts.action.ActionMapping orig, java.util.Map vars)
          Clones the ActionMapping and its children, replacing various properties with the values of the wildcard-matched strings.
protected  java.lang.String convertParam(java.lang.String val, java.util.Map vars)
          Inserts into a value wildcard-matched strings where specified.
 org.apache.struts.action.ActionMapping match(java.lang.String path)
          Matches the path against the compiled wildcard patterns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
The logging instance


compiledPaths

protected java.util.List compiledPaths
The compiled paths and their associated ActionMapping's

Constructor Detail

ActionMappingMatcher

public ActionMappingMatcher(org.apache.struts.config.ModuleConfig appConfig)
Finds and precompiles the wildcard patterns from the ActionMapping "path" attributes. Uses a LinkedHashMap to store the compiled patterns so ActionMapping's will be evaluated in the order they exist in the Struts config file

Parameters:
appConfig - The ModuleConfig we are associated with
Method Detail

match

public org.apache.struts.action.ActionMapping match(java.lang.String path)
Matches the path against the compiled wildcard patterns.

Parameters:
path - The portion of the request URI for selecting a mapping
Returns:
The action mapping if matched, else null
Throws:
IOException - if an input/output error occurs

convertActionMapping

protected org.apache.struts.action.ActionMapping convertActionMapping(java.lang.String path,
                                                                      org.apache.struts.action.ActionMapping orig,
                                                                      java.util.Map vars)
Clones the ActionMapping and its children, replacing various properties with the values of the wildcard-matched strings.

Parameters:
path - The requested path
orig - The original ActionMapping
vars - A Map of wildcard-matched strings
Returns:
A cloned ActionMapping with appropriate properties replaced with wildcard-matched values

convertParam

protected java.lang.String convertParam(java.lang.String val,
                                        java.util.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