f.Intercepting Filter

  1. Motivation

    1. To implement common pre- and post-processing steps around Web page requests?

  2. Summary

      1. It is an application of Chain of Responsibility Pattern.

    1. Create a chain of composable filters to implement common pre-processing and post-processing tasks during a Web page request.

    2. In some contexts, the term Intercepting Filter is associated with a specific implementation using the Decorator pattern

    3. A straightforward implementation of Intercepting Filter is a filter chain that iterates through a list of all filters. The Web request handler executes the filter chain before passing control to the application logic

            1. Intercepting Filter class diagram

            1. Intercepting Filter sequence diagram

  1. When to Use

      1. TODO

  2. Types/Variants

      1. Event-Driven Filters: It uses multiple Filter Chains one for each processing events and filter implementation are stateless.

  1. Implementation

    1. TODO

  1. Example

      1. TODO

  1. Related Patterns

      1. Front Controller.Intercepting Filter is commonly used in combination with Front Controller.

      2. Decorator: An interesting alternative implementation to the Intercepting Filter pattern uses the Decorator pattern around a Front Controller.

  1. Related Technologies

      1. TODO

  1. Specific Considerations

    1. Decorator Vs Intercepting Filter

      1. The key difference between Intercepting Filter and Observerlies in the fact that the observer generally does not modify the source object; it "observes" passively what is going on in the source object.

      2. The purpose of Intercepting Filter, on the other hand, is to intercept and modify the context in which it is called.

  1. References