You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Tony Collen <co...@umn.edu> on 2004/06/08 21:16:47 UTC

Groovy, Flow & Page Templates

Alright, with all the Groovy activity going on lately, I had a simple question, 
perhaps it is "too" obvious and I'm missing it.

Given the following Pipeline and Flow:

<map:match pattern="*.gsp">
   <map:generate type="script" src="{1}.gy"/>
   <map:serialize type="xml"/>
</map:match>

function main() {
   ...
   sendPageAndWait("confirm_register.gsp", {"bizdata" : bizdata});
   ...
}

How would one go about getting:
   a) The bizdata object
   b) The continuation id

Or is it not possible yet since we're on the bleeding edge? ;)

Regards,
Tony

Re: Groovy, Flow & Page Templates

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 9 juin 04, à 16:49, Tony Collen a écrit :
> ...Perhaps it's time to see what a GroovyGenerator can do.

Well, if you have some free time I'd say: go for it!!!
-Bertrand


Re: Groovy, Flow & Page Templates

Posted by Tony Collen <co...@umn.edu>.
Bertrand Delacretaz wrote:
> Le 8 juin 04, à 21:16, Tony Collen a écrit :
> 
>> ...  <map:generate type="script" src="{1}.gy"/>
> 
> ...
> 
>>   sendPageAndWait("confirm_register.gsp", {"bizdata" : bizdata});
>>   ...
>>
>> How would one go about getting:
>>   a) The bizdata object
>>   b) The continuation id
> 
> 
> I guess the question is "where does sendPageAndWait store bizdata", but 
> I don't know ;-)
> 
> If it's request attributes, you'll be able to get at them from Groovy 
> through the objectModel and then the request object. And the 
> ScriptableGenerator can be easily ehanced to make more stuff available 
> directly to Groovy scripts.
> 
> Note that, last time I checked, the execution of Groovy-based pages was 
> *very* slow, like down to 2 pages per second only. It might not be a 
> Groovy problem, but rather our naive implementation which probably 
> initializes a lot of stuff and interprets the Groovy script every time. 
> There are better ways to embed Groovy than BSF tough [1], so it might be 
> worth writing something better in someone's Copious Free Time...
> 

Yeah, I noticed this in my testing.  The BSF is great for prototyping 
Generators.  I also absolutely love Groovy's syntax for XML.  I saw that there 
was stuff about making it all cacheable, which is obviously good.  I'm still 
trying to search for "The Perfect Template Language"... the JX is nice, but it's 
also nicer to have alternatives.  Perhaps it's time to see what a 
GroovyGenerator can do.

Tony

Re: Groovy, Flow & Page Templates

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Bertrand Delacretaz wrote:

> Le 8 juin 04, à 21:16, Tony Collen a écrit :
> 
>> ...  <map:generate type="script" src="{1}.gy"/>
> 
> ...
> 
>>   sendPageAndWait("confirm_register.gsp", {"bizdata" : bizdata});
>>   ...
>>
>> How would one go about getting:
>>   a) The bizdata object
>>   b) The continuation id
> 
> 
> I guess the question is "where does sendPageAndWait store bizdata", but 
> I don't know ;-)
in ObjectModel, see o.a.c.components.flow.FlowHelper

-- 
Leszek Gawron                                      lgawron@mobilebox.pl


Re: Groovy, Flow & Page Templates

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 8 juin 04, à 21:16, Tony Collen a écrit :

> ...  <map:generate type="script" src="{1}.gy"/>
...
>   sendPageAndWait("confirm_register.gsp", {"bizdata" : bizdata});
>   ...
>
> How would one go about getting:
>   a) The bizdata object
>   b) The continuation id

I guess the question is "where does sendPageAndWait store bizdata", but 
I don't know ;-)

If it's request attributes, you'll be able to get at them from Groovy 
through the objectModel and then the request object. And the 
ScriptableGenerator can be easily ehanced to make more stuff available 
directly to Groovy scripts.

Note that, last time I checked, the execution of Groovy-based pages was 
*very* slow, like down to 2 pages per second only. It might not be a 
Groovy problem, but rather our naive implementation which probably 
initializes a lot of stuff and interprets the Groovy script every time. 
There are better ways to embed Groovy than BSF tough [1], so it might 
be worth writing something better in someone's Copious Free Time...

-Bertrand

[1] http://groovy.codehaus.org/Embedding+Groovy