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.
ContextListener
- Allows embeddings to be notified of the creation, entering, exiting,
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.
WrapHandler - Interface
embedders can implement in order to control the way Java objects are wrapped
for use by JavaScript.
ClassOutput - Interface
embedders can implement in order to control the placement of generated
class bytecodes.
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.
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 importClass and importPackage functions.
Exceptions
These exceptions are thrown by JavaScript.
JavaScriptException
- Thrown from within JavaScript by the JavaScript 'throw' statement, or
by LiveConnect calls from JavaScript into Java. Wraps a JavaScript value.
ClassDefinitionException
- Thrown if errors are detected while attempting to define a host object
from a Java class.
PropertyException
- Thrown if errors are detected while attempting to define a property of
a host object from a Java class or method, or if a property is not found.
NotAFunctionException
- Thrown when attempting to call an object that is not a function.
EvaluatorException
- An exception thrown when an error is detected during the execution of
a script. The default error reporter will throw EvaluatorExceptions when
an error is encountered.