Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.opensymphony.xwork2.config.impl
Class ActionConfigMatcher

    java.lang.Object
      com.opensymphony.xwork2.config.impl.ActionConfigMatcher

All Implemented Interfaces:
  Serializable

    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 config file. The first match wins, so more specific patterns should be defined before less specific patterns.

See Also:
  Serialized Form

Nested Class Summary
`private class` | `ActionConfigMatcher.Mapping` Stores a compiled wildcard pattern and the ActionConfig it came from.

Field Summary
`private List` | `compiledPaths` The compiled paths and their associated ActionConfig's
`private static Log` | `log` The logging instance
`private static WildcardHelper` | `wildcard` Handles all wildcard pattern matching.

Constructor Summary
`ActionConfigMatcher(Map<String,ActionConfig> configs)` Finds and precompiles the wildcard patterns from the ActionConfig "path" attributes.
`ActionConfigMatcher(Map<String,ActionConfig> configs, boolean looseMatch)` Finds and precompiles the wildcard patterns from the ActionConfig "path" attributes.

Method Summary
`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 with the {x} syntax.
`ActionConfig` | `match(String path)` Matches the path against the compiled wildcard patterns.
`protected Map<String,Object>` | `replaceParameters(Map<String,Object> orig, Map vars)` Replaces parameter values

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    private static final Log log

  The logging instance

### wildcard

    private static final WildcardHelper wildcard

  Handles all wildcard pattern matching.

### compiledPaths

    private List compiledPaths

  The compiled paths and their associated ActionConfig's

Constructor Detail

### ActionConfigMatcher

    public ActionConfigMatcher(Map<String,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 config file. Only paths that actually contain a wildcard will be compiled. Patterns will matched strictly.

  Parameters:
    `configs` - An array of ActionConfig's to process

### ActionConfigMatcher

    public ActionConfigMatcher(Map<String,ActionConfig> configs,
                               boolean looseMatch)

  Finds and precompiles the wildcard patterns from the ActionConfig "path" attributes. ActionConfig's will be evaluated in the order they exist in the config file. Only paths 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:
    `configs` - An array of ActionConfig's to process
    `looseMatch` - To loosely match wildcards or not

Method Detail

### 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

### 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

### replaceParameters

    protected Map<String,Object> replaceParameters(Map<String,Object> orig,
                                                   Map vars)

  Replaces parameter values

  Parameters:
    `orig` - The original parameters with placehold values
    `vars` - A Map of wildcard-matched strings

### convertParam

    protected String convertParam(String val,
                                  Map vars)

  Inserts 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.