Helma Logo
main list history
previous version  overview  next version

Version 1 by hannes on 16. May 2008, 09:59

Helma NG provides a mechanism to bind Javascript functions as callbacks for certain events. Events can be freely assigned, and it is possible to register multiple callbacks per event.

=== Java API

Class *org.helma.javascript.RhinoEngine|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html* provides methods *addCallback()|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html#addCallback(java.lang.String,%20java.lang.String,%20org.mozilla.javascript.Function)*, *removeCallback|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html#removeCallback(java.lang.String,%20java.lang.String)*, and *invokeCallback()|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html#invokeCallback(java.lang.String,%20java.lang.Object,%20java.lang.Object...)* to register, remove, and invoke callbacks.

=== Javascript API

The *helma.rhino module|http://dev.helma.org/trac/helma/browser/helma-ng/trunk/modules/helma/rhino.js* provides *addCallback(), removeCallback(), and invokeCallback() methods|http://dev.helma.org/trac/helma/browser/helma-ng/trunk/modules/helma/rhino.js#L34* to register, remove and invoke callbacks.

=== Callbacks used by Helma core classes and modules

* onInvoke is called by *org.helma.javascript.RhinoEngine|http://dev.helma.org/static/ng/api/org/helma/javascript/RhinoEngine.html* immediately before request evaluation is started with the same arguments as the invocation.
* onRequest is called by the *helma.simpleweb|http://dev.helma.org/trac/helma/browser/helma-ng/trunk/modules/helma/simpleweb.js* module at the beginning of the handleRequest() method with the Request object as argument.
* onResponse is called by the *helma.simpleweb|http://dev.helma.org/trac/helma/browser/helma-ng/trunk/modules/helma/simpleweb.js* module at the end of the handleRequest() method with the Response object as argument.
* onLogEvent is called by *org.helma.util.RhinoAppender|http://dev.helma.org/static/ng/api/org/helma/util/RhinoAppender.html* with the formatted log message as argument and optionally a formatted stack trace as second argument.

     removed
     added