public class RhinoScript extends Object implements CompiledScript
This implementation pre-compiles the provided script. Any syntax errors in the source code will throw an exception during construction of the object.
Modifier and Type | Field and Description |
---|---|
static org.mozilla.javascript.tools.shell.Global |
GLOBAL |
Constructor and Description |
---|
RhinoScript(String name,
RhinoScriptEngine engine,
org.mozilla.javascript.commonjs.module.RequireBuilder requireBuilder,
boolean sharedScope) |
RhinoScript(String name,
org.mozilla.javascript.Script compiledScript,
RhinoScriptEngine engine,
org.mozilla.javascript.commonjs.module.RequireBuilder requireBuilder,
boolean sharedScope) |
Modifier and Type | Method and Description |
---|---|
Object |
eval(Context ctx,
Bindings request,
Bindings... scopes)
Evaluated the script stored in this
CompiledScript object. |
Bindings |
prepareBindings(Context context,
Bindings request,
Bindings... scopes) |
public RhinoScript(String name, org.mozilla.javascript.Script compiledScript, RhinoScriptEngine engine, org.mozilla.javascript.commonjs.module.RequireBuilder requireBuilder, boolean sharedScope)
name
- the name of the scriptcompiledScript
- the to-be-executed compiled scriptengine
- the parent script enginerequireBuilder
- The CommonJS module builder for Require instances.sharedScope
- Indicates if this script instance should use the shared scope. 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.public RhinoScript(String name, RhinoScriptEngine engine, org.mozilla.javascript.commonjs.module.RequireBuilder requireBuilder, boolean sharedScope)
name
- the name of the scriptengine
- the parent script enginerequireBuilder
- The CommonJS module builder for Require instances.sharedScope
- Indicates if this script instance should use the shared scope. 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.public Bindings prepareBindings(Context context, Bindings request, Bindings... scopes)
prepareBindings
in interface CompiledScript
public Object eval(Context ctx, Bindings request, Bindings... scopes) throws ScriptException
CompiledScript
CompiledScript
object.
eval
in interface CompiledScript
ctx
- A context
associated with the
Request
.request
- A ScriptContext
that is used in the same way as
the ScriptContext
passed to the eval
methods of ScriptEngine
.scopes
- Additional Bindings
extending the request
with.null
if no value is returned by the script
execution.ScriptException
- if an error occurs.Copyright © 2025 Open Identity Platform Community. All rights reserved.