You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jose Luis Carmona <jl...@integromics.com> on 2009/03/05 18:28:36 UTC
Flowscript parameters access
Hi all,
I'm building a generator Who will be invoked from a flowscript Who pass
a JSONObject. I want to access to this JSONObject from the generator but
i don't know how to do that.
In my flowscript I use
cocoon.sendPage("foo", JSONObject);
In my sitemap
<map:match pattern="foo">
<map:generate type="fooGenerator"/>
<map:transform type="xmldb"/>
<map:serialize type="xml"/>
</map:match>
I think I have to access to the JSONObject from the method "configure"
inside my "fooGenerator".
Could You help me?
Thanks a lot,
Jose.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Flowscript parameters access
Posted by Luca Morandini <lm...@ieee.org>.
Jose Luis Carmona wrote:
>
> I'm building a generator Who will be invoked from a flowscript Who pass
> a JSONObject. I want to access to this JSONObject from the generator but
> i don't know how to do that.
>
> In my flowscript I use
>
> cocoon.sendPage("foo", JSONObject);
More probably something like:
cocoon.sendPage("foo", {json: JSONObject});
> <map:match pattern="foo">
> <map:generate type="fooGenerator"/>
> <map:transform type="xmldb"/>
> <map:serialize type="xml"/>
> </map:match>
Almost, let's reshuffle the generation stage a bit:
<map:generate type="fooGenerator">
<map:parameter name="json" value="{flow-attr:json}"/>
</map:generate>
> I think I have to access to the JSONObject from the method "configure"
> inside my "fooGenerator".
Not quite: "configure" is used to set the component in the <generators>
section of the sitemap, while "setup" is used to retrieve parameters
specified in the pipeline (i.e. the generation stage).
To get "json" you have to search it in the "parameters" argument passed
to the "setup" method of your generator.
Regards,
--------------------
Luca Morandini
www.lucamorandini.it
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org