cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reinhard Poetz" <reinh...@apache.org>
Subject [Flow] Support for interceptions
Date Sat, 06 Sep 2003 13:26:46 GMT

This week I have invested some time in writing a prototyp following
Stefano's proposal about intercepted flowscripts.

I added the support for interceptions without touching Rhino but by
enhancing the JavascriptInterpreter. This enhanced
Javascript-Interpreter can be found within the scratchpad block. It uses
the "JavascriptAspectWeaver" which does all the magic of interception.
If you want to use the enhanced flow interpreter, compile Cocoon without
excluding the scratchpad and then you have to use

  <map:flow language="intercepted-javascript">
    <map:script src="<yourScript>"/>
  </map:flow>

in your sitemap.

I also added a small example which can be found in the scratchpad
examples section.

The changes for the already existing JavaScript Interpreter are very
small (only a few lines of code) - I duplicated the code because I
haven't wanted to add this feature to the core 2.1.x branch ATM.

Before I list the (many) missing features a summary of features that are
already implemented:

 * supported interception types:
   - before()
   - after()
   - around()
 * apply your interception scripts by
   cocoon.apply( "srcResolvedBySourceResolver" );
 * the order of interceptions depends on the
   order of the cocoon.apply statements
 * the result script is added to the flow logger
   as INFO message


And here the missing (but planned) features:

 * after() interceptions are added *after* the "return"
 * after() interceptions have to be added in reverse order
 * continuations are not supported (needs another interception event
like
   before-sendPageAndWait() and after-sendPageAndWait() ???)
 * no support for object property functions
 * how to deal with more than one around interception?
 * does not work for scripts loaded by "cocoon.load(...)"
 * throw appropriate exeptions
 * if applied scripts change they are not reloaded (a change in
   the base script is necessary)
 * no syntax check for base script
 * no syntax check for result scripts
 * the result script should be pretty printed
   and put into the directory of the base script
   if file protocol is used
   --> enables easier debugging
 * pass the calling function name to the interception scripts
 * review the naming of all classes and methods

Of course your feedback and/or your help is always welcome!

Cheers,
Reinhard


Mime
View raw message