com.opensymphony.xwork2.interceptor

## Class MethodFilterInterceptor

- java.lang.Object
- - com.opensymphony.xwork2.interceptor.AbstractInterceptor
  - - com.opensymphony.xwork2.interceptor.MethodFilterInterceptor

- All Implemented Interfaces:
    Interceptor, Serializable
  Direct Known Subclasses:
    ConversionErrorInterceptor, DefaultWorkflowInterceptor, ExecuteAndWaitInterceptor, ParametersInterceptor, PrepareInterceptor, TokenInterceptor, ValidationInterceptor

      public abstract class MethodFilterInterceptor
      extends AbstractInterceptor

  MethodFilterInterceptor is an abstract `Interceptor` used as a base class for interceptors that will filter execution based on method names according to specified included/excluded method lists.

  Settable parameters are as follows:
  - excludeMethods - method names to be excluded from interceptor processing
  - includeMethods - method names to be included in interceptor processing

  NOTE: If method name are available in both includeMethods and excludeMethods, it will be considered as an included method: includeMethods takes precedence over excludeMethods.

  Interceptors that extends this capability include:
  - TokenInterceptor
  - TokenSessionStoreInterceptor
  - DefaultWorkflowInterceptor
  - ValidationInterceptor
  Author:
    Alexandru Popescu, Rainer Hermanns
  See Also:
    `TokenInterceptor`, `TokenSessionStoreInterceptor`, `DefaultWorkflowInterceptor`, `ValidationInterceptor`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Set<String>` | `excludeMethods`
    `protected Set<String>` | `includeMethods`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodFilterInterceptor()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `applyInterceptor(ActionInvocation invocation)`
    `protected abstract String` | `doIntercept(ActionInvocation invocation)` Subclasses must override to implement the interceptor logic.
    `Set<String>` | `getExcludeMethodsSet()`
    `Set<String>` | `getIncludeMethodsSet()`
    `String` | `intercept(ActionInvocation invocation)` Override to handle interception
    `void` | `setExcludeMethods(String excludeMethods)`
    `void` | `setIncludeMethods(String includeMethods)`

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

    - #### excludeMethods

          protected Set<String> excludeMethods

    - #### includeMethods

          protected Set<String> includeMethods

  - ### Constructor Detail

    - #### MethodFilterInterceptor

          public MethodFilterInterceptor()

  - ### Method Detail

    - #### setExcludeMethods

          public void setExcludeMethods(String excludeMethods)

    - #### getExcludeMethodsSet

          public Set<String> getExcludeMethodsSet()

    - #### setIncludeMethods

          public void setIncludeMethods(String includeMethods)

    - #### getIncludeMethodsSet

          public Set<String> getIncludeMethodsSet()

    - #### 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`
      Parameters:
        `invocation` - the action invocation
      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()`.

    - #### applyInterceptor

          protected boolean applyInterceptor(ActionInvocation invocation)

    - #### doIntercept

          protected abstract String doIntercept(ActionInvocation invocation)
                                         throws Exception

      Subclasses must override to implement the interceptor logic.
      Parameters:
        `invocation` - the action invocation
      Returns:
        the result of invocation
      Throws:
        `Exception` - in case of any errors

Copyright © 2000–2022 Apache Software Foundation. All rights reserved.