public class SwitchFilter extends Object implements Filter
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.Modifier and Type | Class and Description |
---|---|
static class |
SwitchFilter.Heaplet
Creates and initializes an expect filter in a heap environment.
|
Constructor and Description |
---|
SwitchFilter() |
Modifier and Type | Method and Description |
---|---|
SwitchFilter |
addRequestCase(Expression<Boolean> condition,
Handler handler)
Add a request switch case with a condition and the handler to execute if condition yields.
|
SwitchFilter |
addResponseCase(Expression<Boolean> condition,
Handler handler)
Add a response switch case with a condition and the handler to execute if condition yields.
|
Promise<Response,NeverThrowsException> |
filter(Context context,
Request request,
Handler next)
Filters the request and/or response of an exchange.
|
public SwitchFilter addRequestCase(Expression<Boolean> condition, Handler handler)
condition
- expression to evaluatehandler
- handler to be executed if the condition yieldspublic SwitchFilter addResponseCase(Expression<Boolean> condition, Handler handler)
condition
- expression to evaluatehandler
- handler to be executed if the condition yieldspublic Promise<Response,NeverThrowsException> filter(Context context, Request request, Handler next)
Filter
next.handle(context, request)
.
This method may elect not to pass the request to the next filter or
handler, and instead handle the request itself. It can achieve this by
merely avoiding a call to next.handle(context, request)
and creating its own response object. The filter is also at liberty to
replace a response with another of its own by intercepting the response
returned by the next handler.
Copyright 2011-2017 ForgeRock AS.