Class ScriptableFilter

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

    public class ScriptableFilter
    extends AbstractScriptableHeapObject<org.forgerock.http.protocol.Response>
    implements org.forgerock.http.Filter
    A scriptable filter. This filter acts as a simple wrapper around the scripting engine. Scripts are provided with the bindings provided by AbstractScriptableHeapObject plus :
    • context - the associated request context
    • request - the HTTP request
    • next - the next handler in the filter chain.

    Contains also easy access to attributes from the AttributesContext, e.g: attributes.user = "jackson", instead of contexts.attributes.attributes.user = "jackson".

    In the same way, it gives access to session from the SessionContext, for example, you can use: session.put(...), instead of contexts.session.session.put(...).

    Like Java based filters, scripts are free to choose whether or not they forward the request to the next handler or, instead, return a response immediately.

    • Method Detail

      • 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