Class ReactiveFilter<C,​I1,​O1,​I2,​O2>

  • Type Parameters:
    C - Context in which the filter will be evaluated
    I1 - Type of the request received by this filter
    O1 - Type of the response answered by this filter
    I2 - Type of the request emitted to the handler/next filter
    O2 - Type of the response emitted by the handler/next filter
    Direct Known Subclasses:
    ReactiveFilter.SimpleReactiveFilter

    public abstract class ReactiveFilter<C,​I1,​O1,​I2,​O2>
    extends Object
    Filters and/or transforms the request and/or response of an exchange.
    
                    +--------+              +---------+
       ---> I1 ---> |        | ---> I2 ---> |         |
                    | Filter |              | Handler |
       <--- O1 --<  |        | <--- O2 <--- |         |
                    +--------+              +---------+
    
                    +--------+              +---------+              +---------+
       ---> I1 ---> |  One   | ---> I2 ---> | AndThen | ---> I3 ---> |         |
                    | Filter |              | Filter  |              | Handler |
       <--- O1 --<  |        | <--- O2 <--- |         | <--- O3 ---< |         |
                    +--------+              +---------+              +---------+
     
    • Constructor Detail

      • ReactiveFilter

        public ReactiveFilter()
    • Method Detail

      • andThen

        public ReactiveFilter<C,​I1,​O1,​I2,​O2> andThen​(boolean condition,
                                                                             ReactiveFilter<C,​I2,​O2,​I2,​O2> next)
        Optionally concatenate a new filter to this filter.
        Parameters:
        condition - If true, next will be concatenated to this filter
        next - The filter to optionally concatenate with this one
        Returns:
        If condition is true, returns the concatenation of this filter and next. Otherwise, return this filter.
      • andThen

        public <I3,​O3> ReactiveFilter<C,​I1,​O1,​I3,​O3> andThen​(ReactiveFilter<C,​I2,​O2,​I3,​O3> next)
        Concatenate a transformer filter to this filter.
        Type Parameters:
        I3 - Target type of the request transformed by the filter
        O3 - Source type of the response transformed by the filter
        Parameters:
        next - The transformer filter to add after this filter.
        Returns:
        A new ReactiveFilter results of the concatenation of this filter and the transformer filter
      • filter

        public abstract O1 filter​(C context,
                                  I1 request,
                                  ReactiveHandler<C,​I2,​O2> next)
                           throws Exception
        Perform the request and/or response filtering and/or transformation.
        Parameters:
        context - Context of the filtering/transformation
        request - Request to filter
        next - ReactiveHandler to call once the filtering/transformation is done
        Returns:
        The filtered and/or transformed response
        Throws:
        Exception - If the operation cannot be done