You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Antonio Gallardo <ag...@agssa.net> on 2006/08/09 21:11:05 UTC

How to get whole bizData (or contextObject) object from javascript flow function?

Hi,

 From a java class I call:

pipelineUtil.processToStream("render/renderPage", bizData, fos); [1]

Because I need to use java inside the jxTemplate, I needed to add a 
javascript flow function to call the jxTemplate pipeline. My problem is 
I don't know how to get the whole bizDataObject from javascript flow, so 
far I found:

Packages.org.apache.cocoon.components.flow.FlowHelper.getContextObject(objectModel); 
[2]

Should return the bizData object.

My question is how to get the objectModel inside a flow function to to 
call FlowHelper.getContextObject() ?

Best Regards,

Antonio Gallardo.

[1] 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/flow/util/PipelineUtil.html#processToStream(java.lang.String,%20java.lang.Object,%20java.io.OutputStream)
[2] 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/flow/FlowHelper.html#getContextObject(java.util.Map)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How to get whole bizData (or contextObject) object from javascript flow function?

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Aug 9, 2006, at 12:37 PM, Mark Lundquist wrote:

> Can you add another level of indirection?:
> [blah, blah, blah...]

Ignore that... I just re-read your post and saw that I misunderstood 
your problem.
—ml—




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: How to get whole bizData (or contextObject) object from javascript flow function?

Posted by Mark Lundquist <ml...@wrinkledog.com>.
Hi Antonio,

On Aug 9, 2006, at 12:11 PM, Antonio Gallardo wrote:

> pipelineUtil.processToStream("render/renderPage", bizData, fos); [1]
>
> Because I need to use java inside the jxTemplate, I needed to add a 
> javascript flow function to call the jxTemplate pipeline. My problem 
> is I don't know how to get the whole bizDataObject from javascript 
> flow

Can you add another level of indirection?:

	final Whatever data = whatever;
	pipelineUtils.processToStream (
			"render/renderPage",
			new Object() {
				public Whatever value = data;
			},
			fos
		);

Then in your JXT, ${value} is the object you want.

—ml—


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


[SOLVED] Re: How to get whole bizData (or contextObject) object from javascript flow function?

Posted by Antonio Gallardo <ag...@agssa.net>.
Eric Meyer provided the solution:

Send the bizData as a request Attribute and retrieve it back in the flow 
function.

In the below sample, before calling

pipelineUtil.processToStream("render/renderPage", bizData, fos)

We added:

    Map objectModel = ContextHelper.getObjectModel(this.context);
    Request request = ObjectModelHelper.getRequest(objectModel);
    request.setAttribute("bizData", bizData);

   Then in the flow function we retrieved the bizData as follows:

var bizData = cocoon.request.getAttribute("bizData");
cocoon.sendPage("render/renderPageView, bizData);

Best Regards,

Antonio Gallardo.

Antonio Gallardo escribió:
> Hi,
>
> From a java class I call:
>
> pipelineUtil.processToStream("render/renderPage", bizData, fos); [1]
>
> Because I need to use java inside the jxTemplate, I needed to add a 
> javascript flow function to call the jxTemplate pipeline. My problem 
> is I don't know how to get the whole bizDataObject from javascript 
> flow, so far I found:
>
> Packages.org.apache.cocoon.components.flow.FlowHelper.getContextObject(objectModel); 
> [2]
>
> Should return the bizData object.
>
> My question is how to get the objectModel inside a flow function to to 
> call FlowHelper.getContextObject() ?
>
> Best Regards,
>
> Antonio Gallardo.
>
> [1] 
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/flow/util/PipelineUtil.html#processToStream(java.lang.String,%20java.lang.Object,%20java.io.OutputStream) 
>
> [2] 
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/flow/FlowHelper.html#getContextObject(java.util.Map) 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org