commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Libbrecht <>
Subject Re: Jelly: run script from string
Date Mon, 15 Sep 2003 08:38:33 GMT
On Lundi, sept 15, 2003, at 09:47 Europe/Paris, Sylvain Chambon wrote:

> On Fri, 12 Sep 2003 14:18:46 -0400, Daryl Stultz <> 
> wrote:
>> I'd like to execute a script from a raw string (perhaps it comes from 
>> a
>> database). How can I do this? It seems all the runScript methods take 
>> a
>> url or a file.
> If there's an easy way I didn't find it... What I did was extend 
> JellyContext in order to have a compileScript method that can use a 
> String (which is fairly easy as what the parser really needs is an 
> InputStream -- give it a ByteArrayInputStream taken from your String's 
> bytes).

Why not use all things with "Characters" ? (i.e. a StringReader ? A 
reader is also accepted for an InputSource).

> Then you have a Script object which you can call the run(JellyContext, 
> XMLOutput) method on.
> I use this hack extensively (in a presentation framework that is made 
> of myriads of tiny scripts assembled together at runtime) and have 
> done for a few months now; it may not be the "cleanest" way to do it 
> but it works fine so far. The major problem would be keeping track of 
> changes to the Jelly APIs, in particular JellyContext and Script.

There hasn't been much changes since March so it might be good you 
submit the addition of the named method as a patch ?


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

View raw message