Package org.forgerock.openig.filter
Class SwitchFilter
- java.lang.Object
-
- org.forgerock.openig.filter.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 totrue, then the processing flow is diverted to the associated handler. If no condition evaluates totrue, then the request flows normally through the filter.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSwitchFilter.HeapletCreates and initializes an expect filter in a heap environment.
-
Constructor Summary
Constructors Constructor Description SwitchFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SwitchFilteraddRequestCase(Expression<Boolean> condition, org.forgerock.http.Handler handler)Add a request switch case with a condition and the handler to execute if condition yields.SwitchFilteraddResponseCase(Expression<Boolean> condition, org.forgerock.http.Handler handler)Add a response switch case with a condition and the handler to execute if condition yields.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)
-
-
-
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 evaluatehandler- 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 evaluatehandler- 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:
filterin interfaceorg.forgerock.http.Filter
-
-