org.apache.sling.scripting.javascript.helper
Class SlingGlobal

java.lang.Object
  extended by org.apache.sling.scripting.javascript.helper.SlingGlobal
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.IdFunctionCall

public class SlingGlobal
extends java.lang.Object
implements java.io.Serializable, org.mozilla.javascript.IdFunctionCall

The SlingGlobal class provides two interesting new global functions which are not part of the ECMAScript standard but which are available in the Rhino Shell and which may be of use by JavaScripts:

print(args, ...)
Prints the arguments args in a single message to the scripts logger available as the global log variable.
load(args, ...)
Loads the scripts named as parameters into the current scope one, after the other. Usually the script files are read as plain JavaScript files. If the file extension happens to be .esp to indicate an ECMAScript Server Page, the file is read through an EspReader. Failure to read one of the files throws an error.

See Also:
Serialized Form

Constructor Summary
SlingGlobal()
           
 
Method Summary
 java.lang.Object execIdCall(org.mozilla.javascript.IdFunctionObject f, org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable scope, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args)
           
static void init(org.mozilla.javascript.Scriptable scope, boolean sealed)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlingGlobal

public SlingGlobal()
Method Detail

init

public static void init(org.mozilla.javascript.Scriptable scope,
                        boolean sealed)

execIdCall

public java.lang.Object execIdCall(org.mozilla.javascript.IdFunctionObject f,
                                   org.mozilla.javascript.Context cx,
                                   org.mozilla.javascript.Scriptable scope,
                                   org.mozilla.javascript.Scriptable thisObj,
                                   java.lang.Object[] args)
Specified by:
execIdCall in interface org.mozilla.javascript.IdFunctionCall


Copyright © 2007-2009. All Rights Reserved.