Package org.forgerock.openig.filter
Class AssignmentFilter
java.lang.Object
org.forgerock.openig.filter.AssignmentFilter
- All Implemented Interfaces:
Filter
Conditionally assigns values to expressions before and after the request is handled.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Creates and initializes an assignment filter in a heap environment. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddRequestBinding
(Expression<Boolean> condition, LeftValueExpression<?> target, Expression<?> value) Registers a conditional binding on the request flow.addRequestBinding
(LeftValueExpression<?> target) Registers an unconditional (always executed) binding on the request flow.addRequestBinding
(LeftValueExpression<?> target, Expression<?> value) Registers an unconditional (always executed) binding on the request flow.addResponseBinding
(Expression<Boolean> condition, LeftValueExpression<?> target, Expression<?> value) Registers a conditional binding on the response flow.addResponseBinding
(LeftValueExpression<?> target) Registers an unconditional (always executed) binding on the response flow.addResponseBinding
(LeftValueExpression<?> target, Expression<?> value) Registers an unconditional (always executed) binding on the response flow.Filters the request and/or response of an exchange.
-
Constructor Details
-
AssignmentFilter
public AssignmentFilter()
-
-
Method Details
-
addRequestBinding
Registers an unconditional (always executed) binding on the request flow. The value stored in the target will be null.- Parameters:
target
- Expression that yields the target object whose value is to be set- Returns:
- this object for fluent usage
-
addRequestBinding
Registers an unconditional (always executed) binding on the request flow. The value stored in the target will be the result of the valueExpression
.- Parameters:
target
- Expression that yields the target object whose value is to be setvalue
- Expression that yields the value to be set in the target (may be null)- Returns:
- this object for fluent usage
-
addRequestBinding
public AssignmentFilter addRequestBinding(Expression<Boolean> condition, LeftValueExpression<?> target, Expression<?> value) Registers a conditional binding on the request flow. If the condition is fulfilled, the value stored in the target will be the result of the valueExpression
.- Parameters:
condition
- Condition to evaluate to determine if assignment should occur (may be null, aka unconditional)target
- Expression that yields the target object whose value is to be setvalue
- Expression that yields the value to be set in the target (may be null)- Returns:
- this object for fluent usage
-
addResponseBinding
Registers an unconditional (always executed) binding on the response flow. The value stored in the target will be null.- Parameters:
target
- Expression that yields the target object whose value is to be set- Returns:
- this object for fluent usage
-
addResponseBinding
Registers an unconditional (always executed) binding on the response flow. The value stored in the target will be the result of the valueExpression
.- Parameters:
target
- Expression that yields the target object whose value is to be setvalue
- Expression that yields the value to be set in the target (may be null)- Returns:
- this object for fluent usage
-
addResponseBinding
public AssignmentFilter addResponseBinding(Expression<Boolean> condition, LeftValueExpression<?> target, Expression<?> value) Registers a conditional binding on the response flow. If the condition is fulfilled, the value stored in the target will be the result of the valueExpression
.- Parameters:
condition
- Condition to evaluate to determine if assignment should occur (may be null, aka unconditional)target
- Expression that yields the target object whose value is to be setvalue
- Expression that yields the value to be set in the target (may be null)- Returns:
- this object for fluent usage
-
filter
public Promise<Response,NeverThrowsException> filter(Context context, Request request, Handler next) Description copied from interface:Filter
Filters the request and/or response of an exchange. To pass the request to the next filter or handler in the chain, the filter callsnext.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.
-