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

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

public class SlingGlobal
extends Object
implements 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
 Object execIdCall(org.mozilla.javascript.IdFunctionObject f, org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable scope, org.mozilla.javascript.Scriptable thisObj, Object[] args)
           
static void init(org.mozilla.javascript.Scriptable scope, boolean sealed)
           
 Object require(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args)
           
 
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 Object execIdCall(org.mozilla.javascript.IdFunctionObject f,
                         org.mozilla.javascript.Context cx,
                         org.mozilla.javascript.Scriptable scope,
                         org.mozilla.javascript.Scriptable thisObj,
                         Object[] args)
Specified by:
execIdCall in interface org.mozilla.javascript.IdFunctionCall

require

public Object require(org.mozilla.javascript.Context cx,
                      org.mozilla.javascript.Scriptable thisObj,
                      Object[] args)


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.