Writing Aplicación 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 Subproceso de 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 Subproceso de Arbortext PE and passes the request to the Aplicación Arbortext PE Context (described in The Subproceso de Arbortext PE Application Context). The Aplicación Arbortext PE Context creates the request and response objects. Then, it directs the Subproceso de 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 Aplicación 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 Aplicación Arbortext PE written in Java. Unlike a Java Aplicación Arbortext PE, a JavaScript Aplicación Arbortext PE has no initialization or termination component.
¿Fue esto útil?