Publishing Engine Programmer's Guide > The Arbortext Publishing Engine Sub-Process > Writing Arbortext PE Applications in JavaScript
  
Writing Arbortext PE Applications 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 Arbortext PE sub-process 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 Arbortext PE sub-process and passes the request to the Arbortext PE Application Context (described in The Arbortext PE sub-process Application Context). The Arbortext PE Application Context creates the request and response objects. Then, it directs the Arbortext PE sub-process 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 Arbortext PE Application can access information about the request and set information to be returned as part of the response using the same interface as an Arbortext PE Application written in Java. Unlike a Java Arbortext PE Application, a JavaScript Arbortext PE Application has no initialization or termination component.