public interface RhinoSandbox
| Modifier and Type | Method and Description |
|---|---|
RhinoSandbox |
allow(Class<?> clazz)
Will allow access to this class in Rhino scripts.
|
Object |
eval(String sourceName,
String js)
Evaluate a script with its own scope.
|
Object |
eval(String soureName,
String js,
Map<String,Object> variables)
Evaluate a script with its own scope.
|
Object |
evalWithGlobalScope(String sourceName,
String js)
Evaluate the given script with the global scope.
|
RhinoSandbox |
inject(Class<org.mozilla.javascript.ScriptableObject> clazz)
Will make this class available to instantiate in Rhino scripts.
|
RhinoSandbox |
inject(String variableName,
Object object)
Will add a global variable available to all scripts executed with this sandbox.
|
RhinoSandbox |
setInstructionLimit(int limit)
Sets the maximum instructions allowed for script execution.
|
RhinoSandbox |
setMaxDuration(int limitInMs)
Sets the maximum allowed duration for scripts.
|
RhinoSandbox |
setUseSafeStandardObjects(boolean useSafeStandardObject)
If .initSafeStandardObjects should be used.
|
RhinoSandbox |
setUseSealedScope(boolean value)
If the global scope should be sealed (default: true).
|
RhinoSandbox allow(Class<?> clazz)
Will allow access to this class in Rhino scripts.
Note that for classes in packages which don't start with java., com., net. etc. the class name needs to be prefixed with Packages.
e.g. mypackage.Myclass will be Packages.mypackage.MyClass
RhinoSandbox inject(String variableName, Object object)
RhinoSandbox inject(Class<org.mozilla.javascript.ScriptableObject> clazz)
RhinoSandbox setInstructionLimit(int limit)
RhinoSandbox setMaxDuration(int limitInMs)
RhinoSandbox setUseSafeStandardObjects(boolean useSafeStandardObject)
RhinoSandbox setUseSealedScope(boolean value)
Object evalWithGlobalScope(String sourceName, String js)
Object eval(String sourceName, String js)
Copyright © 2018. All rights reserved.