The primary purpose is a basis for the the Alt Framework, but it is not limited to this.
The purpose of the Alt Framework is not to reinvent the wheel (which on the surface seems hypocritical). As such, AltServlet is based on the robust Java Servlet technology.
Scripting in AltServlet
var d = new java.awt.Dimension(100,200);
Or you can make aliases:
var Dimension = java.awt.Dimension; var d = new Dimension(100,200);
You can methods and access member variables just as you would in Java:
var area = d.width * d.height; d.setSize(800,600);
In addition to regular syntax, Rhino adds a few convenience features for JavaBean-style access. For example, if a class defines methods such as getXxx and setXxx, you can access them like member variables.
var url = new java.net.URL("http://marcello.cellosoft.com/"); var port = url.port; // same as url.getPort()
AltServlet Dynamic Scope
AltServlet implements dynamic scope. This means allows modules to be defined in their own scope and for separate requests to each have their own scope.
This can be illustrated as follows:
You can read any variable from a parent scope as if it were a local variable, but any variable or function you define will be defined in the current scope. This will shadow any variable or function in a higher scope, but not replace them.
You can access the global scope directly with the
You can access modules by writing
|page last updated: Thursday, February 14, 2008|