commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Gilde <>
Subject RE: [Jelly] nested compileScript() with import ?
Date Sun, 05 Dec 2004 20:16:16 GMT
You could easily cache the imported script the first time it's run. This is
a simple modification to the current import tag, so that it keeps the
reference to the script. If you do this, why not add an attribute "cache" to
turn caching on/off and then submit it as a patch to the import tag?

It would be a little harder, but not at all impossible, to make it cache the
imported script at compile time.

If not, the basic idea is this:

A Tag isn't compilable, it's generated at runtime. A Script is compilable,
it's generated at compile time. You need a special Script, not a special
Tag. Scripts are very much like tags except that they need to be thread
safe. Most of the time, a Script called TagScript is used. By default, this
Script creates and caches Tag instances when it's run.

Your new Script would compile the import at compile time. The result of
compiling the import is, it self, a Script instance. At runtime, your Script
would simply pass control to the imported Script.

You would also have to implement a custom TagLibrary. A TagLibrary gets to
create a TagScript (implements Script) for every XML tag in its namespace.
So, your TagLibrary would create a custom TagScript that would compile and
keep the imported XML.

-----Original Message-----
From: Arnaud Masson [] 
Sent: Saturday, December 04, 2004 6:07 PM
Subject: [Jelly] nested compileScript() with import ?


in the current version of jelly "import" tag, it seems that imported 
scripts are always parsed and recompiled each time the containing script 
even if this script has already been compiled.

the problem is that  it isn't optimized if the compiled version of the 
main script is cached.

is it possible to compile all scripts included via <j:import ...> via a 
single call to jellyContext.compileScript() on the containing script ?
should i write a custom tag to implement that (to replace import) ?

thanks in advance


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message