Writing Application Arbortext PEs in JavaScript
An Arbortext Publishing Engine JavaScript application is a subroutine function which takes two parameters, a Java request object and a Java response object. The Sous-processus Arbortext PE uses the Rhino JavaScript package to make Java objects accessible to JavaScript programs. Essentially, this means that JavasScript Arbortext Publishing Engine applications run in the same programming environment as Arbortext Publishing Engine Java applications. For more information on making Java available to JavaScript using LiveConnect, refer to the Calling Java from JavaSctipt section of the Programmer's Reference.
The
Arbortext PE Request Manager processes requests for
Arbortext Publishing Engine JavaScript applications by passing requests with the
f query parameter with the value
javascript to the request function
com.arbortext.e3.FunctionJavascript. The request function allocates an
Sous-processus Arbortext PE and passes the request to the
Application Arbortext PE Context (described in
The Sous-processus Arbortext PE Application Context). The
Application Arbortext PE Context creates the request and response objects. Then, it directs the
Sous-processus Arbortext PE JavaScript interpreter to evaluate the function specified in the
function parameter of the HTTP request. The function must be defined in a
.js file in a
custom\init directory or in a
.js file in
custom\scripts which is loaded from
custom\init. The returned value for the JavaScript function is ignored because the data must be transmitted to the client in the response object.
A JavaScript Application Arbortext PE can access information about the request and set information to be returned as part of the response using the same interface as an Application Arbortext PE written in Java. Unlike a Java Application Arbortext PE, a JavaScript Application Arbortext PE has no initialization or termination component.