Rhino
Rhino API Reference.
The Control API
These APIs provide methods for controlling the actions of JavaScript in
a host environment.
See:
Description
Rhino API Reference.
The Control API
These APIs provide methods for controlling the actions of JavaScript in
a host environment.
-
Context - Represents
the runtime context of an executing script. Has methods to associate the
JavaScript evaluation engine with a Java thread, set attributes of the
engine, and compile and evaluate scripts.
-
ContextFactory
- Allows embeddings to customize creation of Context instances and monitor entering and releasing of Contexts.
-
Script - The result of
compiling a JavaScript script. Also encapsulates script execution.
-
ErrorReporter -
This interface can be implemented to control the actions the JavaScript
engine takes when it encounters errors.
-
SecurityController
- Optional support routines that must be provided by embeddings implementing
security controls on scripts.
-
ClassShutter
- Embeddings that wish to filter Java classes that are visible to scripts
through the LiveConnect, should implement this interface.
-
Wrapper - Interface implemented
by objects wrapping other objects. Provides a method for recovering the
wrapped value.
-
WrapFactory - Class
embedders can extend in order to control the way Java objects are wrapped
for use by JavaScript.
-
ClassCompiler - Class that provies API for compiling scripts into JVM class files.
-
ScriptableOutputStream - This stream can be used to serialize JavaScript objects and functions.
-
ScriptableInputStream - This stream can be used to deserialize JavaScript objects and functions.
The Host Object API
These APIs provide support for adding objects specific to a particular
embedding of JavaScript in a host environment. Note that if you just want
to script existing Java classes, you should just use
LiveConnect. See also
LiveConnect 3.0 specs.
It is also helpful to understand some of the implementation of the
runtime.
-
Scriptable - All JavaScript
objects must implement this interface. Provides methods to access properties
and attributes of those properties, as well as other services required
of JavaScript objects.
-
Function - All JavaScript
functions must implement this interface. Extends Scriptable, adding methods
to support invocation.
-
ScriptableObject
- A default implementation of Scriptable that may be extended. Implements
property and attribute storage and lookup and other default JavaScript
object behavior.
-
FunctionObject
- An implementation of Function that allows Java methods and constructors
to be used as JavaScript function objects.
-
ImporterTopLevel
- Allows embeddings to use the JavaImporter constructor.
Exceptions
These exceptions are thrown by JavaScript.
-
RhinoException
- Common root for all exception explicitly thrown by Rhino engine.
JavaScriptException
- Thrown from within JavaScript by the JavaScript 'throw' statement. It wrapps the JavaScript value from 'throw' statement.
-
EcmaError
- Thrown by Rhino runtime when particular runtime operation a scripts tries to execute is not allowed. The exception is thrown, for example, when a script attempts to check properties of undefinedor null or refer to a name that can not be found in the current scope chain.
-
WrappedException
- Thrown by LiveConnect implementation from JavaScript when called Java method exits with an exception. It wraps the original Java exception.
-
EvaluatorException
- An exception thrown when an error is detected during the compilation or execution of
a script. The default error reporter will throw EvaluatorExceptions when
an error is encountered.
back to top