org.apache.struts2.interceptor

## Class AbstractInterceptor

- java.lang.Object
- - org.apache.struts2.interceptor.AbstractInterceptor

- All Implemented Interfaces:
    Serializable, ConditionalInterceptor, Interceptor
  Direct Known Subclasses:
    AbstractInterceptor, AliasInterceptor, ChainingInterceptor, ExceptionMappingInterceptor, LoggingInterceptor, MethodFilterInterceptor, ModelDrivenInterceptor, ParameterRemoverInterceptor, ScopedModelDrivenInterceptor, StaticParametersInterceptor

      public abstract class AbstractInterceptor
      extends Object
      implements ConditionalInterceptor

  Provides default implementations of optional lifecycle methods
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractInterceptor()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()` Does nothing
    `void` | `init()` Does nothing
    `abstract String` | `intercept(ActionInvocation invocation)` Override to handle interception
    `void` | `setDisabled(String disable)` Allows to skip executing a given interceptor, just define `<param name="disabled">true</param>` or use other way to override interceptor's parameters, see docs.
    `boolean` | `shouldIntercept(ActionInvocation invocation)` Determines if a given interceptor should be executed in the current processing of action invocation.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractInterceptor

          public AbstractInterceptor()

  - ### Method Detail

    - #### init

          public void init()

      Does nothing
      Specified by:
        `init` in interface `Interceptor`

    - #### destroy

          public void destroy()

      Does nothing
      Specified by:
        `destroy` in interface `Interceptor`

    - #### intercept

          public abstract String intercept(ActionInvocation invocation)
                                    throws Exception

      Override to handle interception
      Specified by:
        `intercept` in interface `Interceptor`
      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()`.

    - #### setDisabled

          public void setDisabled(String disable)

      Allows to skip executing a given interceptor, just define `<param name="disabled">true</param>` or use other way to override interceptor's parameters, see docs.
      Parameters:
        `disable` - if set to true, execution of a given interceptor will be skipped.

    - #### shouldIntercept

          public boolean shouldIntercept(ActionInvocation invocation)

      Description copied from interface: `ConditionalInterceptor`
      Determines if a given interceptor should be executed in the current processing of action invocation.
      Specified by:
        `shouldIntercept` in interface `ConditionalInterceptor`
      Parameters:
        `invocation` - current `ActionInvocation` to determine if the interceptor should be executed
      Returns:
        true if the given interceptor should be included in the current action invocation

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