|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.caucho.es.Resin
Resin is the primary public entry to the JavaScript compiler.
The script must first be compiled, then executed.
JavaScript import uses a script path to located the imported script. The scriptPath is just an array of Paths. If the scriptPath is null, Resin will default to the script's directory, followed by $RESIN_HOME/scripts.
Here's the default, where 'is' is the input stream:
Path scriptPath[] = new Path[] {
is.getPath().getParent(),
CauchoSystem.getResinHome().lookup("scripts")
}
As described in the Script object, programs set global variables with a hash map. So a simple call might look like:
Script script = Resin.parse(Pwd.lookup("foo.js"), scriptPath);
HashMap props = new HashMap();
props.put("out", System.out);
script.execute(props, null);
Executing the Script object is threadsafe. The ScriptClosure object, of course, is not threadsafe.
Method Summary | |
static com.caucho.es.parser.Parser |
getParser()
|
static void |
init(ESFactory factory)
|
static void |
main(java.lang.String[] argv)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void init(ESFactory factory)
public static com.caucho.es.parser.Parser getParser() throws java.io.IOException, ESException
public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |