public class EnforcerFilter extends Object implements Filter
EnforcerFilter
makes sure that the handled Request
verifies a condition.
If the condition is not verified, it simply returns a 500 internal server error response
(that actually stops the chain execution).Constructor and Description |
---|
EnforcerFilter(Expression<Boolean> enforcement,
Filter delegate)
Creates a new
EnforcerFilter delegating to the given Filter if the enforcement expression yields
true. |
public EnforcerFilter(Expression<Boolean> enforcement, Filter delegate)
EnforcerFilter
delegating to the given Filter
if the enforcement expression yields
true.enforcement
- Expression
that needs to evaluates to true for the delegating Filter to be executed.delegate
- Filter instance to delegate to.public 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-2015 ForgeRock AS.