Class SwitchFilter

  • All Implemented Interfaces:
    org.forgerock.http.Filter

    public class SwitchFilter
    extends Object
    implements org.forgerock.http.Filter
    Conditionally diverts the request to another handler. Before and after the request is handled, associated conditions are evaluated. If a condition evaluates to true, then the processing flow is diverted to the associated handler. If no condition evaluates to true, then the request flows normally through the filter.
    • Constructor Detail

      • SwitchFilter

        public SwitchFilter()
    • Method Detail

      • addRequestCase

        public SwitchFilter addRequestCase​(Expression<Boolean> condition,
                                           org.forgerock.http.Handler handler)
        Add a request switch case with a condition and the handler to execute if condition yields.
        Parameters:
        condition - expression to evaluate
        handler - handler to be executed if the condition yields
        Returns:
        this filter for fluent invocation.
      • addResponseCase

        public SwitchFilter addResponseCase​(Expression<Boolean> condition,
                                            org.forgerock.http.Handler handler)
        Add a response switch case with a condition and the handler to execute if condition yields.
        Parameters:
        condition - expression to evaluate
        handler - handler to be executed if the condition yields
        Returns:
        this filter for fluent invocation.
      • filter

        public org.forgerock.util.promise.Promise<org.forgerock.http.protocol.Response,​org.forgerock.util.promise.NeverThrowsException> filter​(org.forgerock.services.context.Context context,
                                                                                                                                                     org.forgerock.http.protocol.Request request,
                                                                                                                                                     org.forgerock.http.Handler next)
        Specified by:
        filter in interface org.forgerock.http.Filter