Class RhinoScript

  • All Implemented Interfaces:
    org.forgerock.script.engine.CompiledScript

    public class RhinoScript
    extends Object
    implements org.forgerock.script.engine.CompiledScript
    A JavaScript script.

    This implementation pre-compiles the provided script. Any syntax errors in the source code will throw an exception during construction of the object.

    • Field Detail

      • GLOBAL

        public static final org.mozilla.javascript.tools.shell.Global GLOBAL
    • Constructor Detail

      • RhinoScript

        public RhinoScript​(String name,
                           org.mozilla.javascript.Script compiledScript,
                           RhinoScriptEngine engine,
                           org.mozilla.javascript.commonjs.module.RequireBuilder requireBuilder,
                           boolean sharedScope)
                    throws ScriptException
        Compiles the JavaScript source code into an executable script. If useSharedScope is true, then a sealed shared scope containing standard JavaScript objects (Object, String, Number, Date, etc.) will be used for script execution; otherwise a new unsealed scope will be allocated for each execution.
        Parameters:
        compiledScript - the source code of the JavaScript script.
        sharedScope - if true, uses the shared scope, otherwise allocates new scope.
        Throws:
        ScriptException - if there was an exception encountered while compiling the script.
    • Method Detail

      • prepareBindings

        public Bindings prepareBindings​(org.forgerock.services.context.Context context,
                                        Bindings request,
                                        Bindings... scopes)
        Specified by:
        prepareBindings in interface org.forgerock.script.engine.CompiledScript