About Rhinola ============= Rhinola is a server-side web scripting environment using the Mozilla Rhino JavaScript implementation and running on top of the mod_gcj Apache module . The design focus is on simplicity, with easy extensibility through Java or JavaScript libraries. Prerequisites ============= mod_gcj/Rhinola requires GCJ 4.0 or later and Apache with mod_gcj installed. Both Apache 1.3 and 2.0 are supported. Apache Ant is required to build Rhinola. Installing Rhinola ================== The following implies that you have Apache with mod_gcj installed. * Edit build.properties so modgcj points to your mod_gcj directory and gcj matches the name or path of your GCJ compiler. * Run "ant gcjlib". This should take some time and produce two shared libraries called lib-org-mozilla-javascript.so and lib-org-helma-javascript.so. * Install the shared libraries in /usr/lib/. Running Rhinola =============== Add the following lines to your Apache configuration file: AddHandler gcj .xjs GcjHandler org.helma.javascript.Rhinola Then create a file called test.xjs somewhere inside your Apache web document directory with the following content: function handle(req, res) { res.setContentType("text/html"); res.writer.write("hello world!;"); } Restart Apache and load the above file in your web browser. If everything went right, you should see the output of the file processed by Rhinola instead of the source code. Using Rhinola for real work =========================== Rhinola provides a standard JavaScript environment. The req and res arguments passed to the handle() function are ModGcjRequest and ModGcjResponse objects wrapped as JavaScript objects. Refer to the API documentation for an overview of functionality provided by mod_gcj. In addition to the handle(req, res) function invoked by mod_gcj, you can define other functions and properties in the handler object itself, or you can import other Java or JavaScript code using the methods described below below. Rhinola provides an include() function to import JavaScript files: include("path/to/javascript.js"); Included JavaScript files can in turn include other files, so it is easy to build libraries that depend on each other. Each file will only be included once. The classpath() function is used to add Java libraries to the classpath: classpath("path/to/jarfile.jar"); Refer to for an overview on how to script Java classes from mod_gcj or imported using the classpath() function. Both include() and classpath() must be used in the top level scope. In other words, they should be called when the script is first parsed and evaluated, not when the handle() function is invoked with a request. Both functions work with relative path names, with the directory of the current script defining the base for relative names. Feedback ======== Send feedback to Hannes Wallnoefer