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.interceptor
Class ParameterFilterInterceptor

    java.lang.Object
      com.opensymphony.xwork2.interceptor.AbstractInterceptor
          com.opensymphony.xwork2.interceptor.ParameterFilterInterceptor

All Implemented Interfaces:
  Interceptor, Serializable

    public class ParameterFilterInterceptor

extends AbstractInterceptor

The Parameter Filter Interceptor blocks parameters from getting to the rest of the stack or your action. You can use multiple parameter filter interceptors for a given action, so, for example, you could use one in your default stack that filtered parameters you wanted blocked from every action and those you wanted blocked from an individual action you could add an additional interceptor for each action.

- allowed - a comma delimited list of parameter prefixes that are allowed to pass to the action
- blocked - a comma delimited list of parameter prefixes that are not allowed to pass to the action
- defaultBlock - boolean (default to false) whether by default a given parameter is blocked. If true, then a parameter must have a prefix in the allowed list in order to be able to pass to the action

The way parameters are filtered for the least configuration is that if a string is in the allowed or blocked lists, then any parameter that is a member of the object represented by the parameter is allowed or blocked respectively.

For example, if the parameters are:

- blocked: person,person.address.createDate,personDao
- allowed: person.address
- defaultBlock: false

The parameters person.name, person.phoneNum etc would be blocked because 'person' is in the blocked list. However, person.address.street and person.address.city would be allowed because person.address is in the allowed list (the longer string determines permissions). none

       ...

       ...

       ...

         person,person.address.createDate,personDao

       ...

Version:
  $Date: 2006-10-31 05:00:17 +0100 (Di, 31 Okt 2006) $ $Id: ParameterFilterInterceptor.java 1179 2006-10-31 04:00:17Z tm_jee $
Author:
  Gabe
See Also:
  Serialized Form

Field Summary
`private Collection` | `allowed`
`private Collection` | `blocked`
`private boolean` | `defaultBlock`
`private Map` | `includesExcludesMap`
`private static Log` | `LOG`

Constructor Summary
`ParameterFilterInterceptor()`

Method Summary
`private Collection` | `asCollection(String commaDelim)` Return a collection from the comma delimited String.
`Collection` | `getAllowedCollection()`
`Collection` | `getBlockedCollection()`
`private Map` | `getIncludesExcludesMap()`
`String` | `intercept(ActionInvocation invocation)` Override to handle interception
`boolean` | `isDefaultBlock()`
`private boolean` | `isPropSeperator(char c)`
`void` | `setAllowed(String allowed)`
`void` | `setAllowedCollection(Collection allowed)`
`void` | `setBlocked(String blocked)`
`void` | `setBlockedCollection(Collection blocked)`
`void` | `setDefaultBlock(boolean defaultExclude)`

Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor
`destroy, init`

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

### allowed

    private Collection allowed

### blocked

    private Collection blocked

### includesExcludesMap

    private Map includesExcludesMap

### defaultBlock

    private boolean defaultBlock

Constructor Detail

### ParameterFilterInterceptor

    public ParameterFilterInterceptor()

Method Detail

### intercept

    public String intercept(ActionInvocation invocation)
                     throws Exception

  Description copied from class: `AbstractInterceptor`
  Override to handle interception

  Specified by:
    `intercept` in interface `Interceptor`
  Specified by:
    `intercept` in class `AbstractInterceptor`
  Returns:
    the return code, either returned from `ActionInvocation.invoke()`, or from the interceptor itself.
  Throws:
    `Exception` - any system-level error, as defined in `Action.execute()`.

### isPropSeperator

    private boolean isPropSeperator(char c)

  Parameters:
    `c` -
  Returns:
    `true`, if char is property separator, `false` otherwise.

### getIncludesExcludesMap

    private Map getIncludesExcludesMap()

### isDefaultBlock

    public boolean isDefaultBlock()

  Returns:
    Returns the defaultBlock.

### setDefaultBlock

    public void setDefaultBlock(boolean defaultExclude)

  Parameters:
    `defaultExclude` - The defaultExclude to set.

### getBlockedCollection

    public Collection getBlockedCollection()

  Returns:
    Returns the blocked.

### setBlockedCollection

    public void setBlockedCollection(Collection blocked)

  Parameters:
    `blocked` - The blocked to set.

### setBlocked

    public void setBlocked(String blocked)

  Parameters:
    `blocked` - The blocked paramters as comma separated String.

### getAllowedCollection

    public Collection getAllowedCollection()

  Returns:
    Returns the allowed.

### setAllowedCollection

    public void setAllowedCollection(Collection allowed)

  Parameters:
    `allowed` - The allowed to set.

### setAllowed

    public void setAllowed(String allowed)

  Parameters:
    `allowed` - The allowed paramters as comma separated String.

### asCollection

    private Collection asCollection(String commaDelim)

  Return a collection from the comma delimited String.

  Parameters:
    `commaDelim` -
  Returns:
    A collection from the comma delimited String.

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.