You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2003/08/13 13:34:17 UTC

converting FlowApp to new FOM

Hi All,

I am in the process of converting a flow app written for Cocoon2.1RC1 
to the new FOM.

The first problem I face is with the Request Object.

My helper Java Classes have been written to take an 
org.apache.cocoon.environment.Request Object, but now my flowscripts 
are not able to pass this anymore.

public interface Form {
	
	/**
	 * Update the Form from the incoming Request Parameters
	 * @param request Cocoon Request
	 */	
	public void populate (org.apache.cocoon.environment.Request request);

// snip
}

The only methods of Request that my Classes call are to do with getting 
request parameters.

Is it safe to just convert these classes to use the 
org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.FOM_Request 
and call methods like public String jsFunction_getParameter(String 
name) instead?

Or do I need a different approach?

thanks for any help

regards Jeremy


Re: converting FlowApp to new FOM

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Wednesday, August 13, 2003, at 02:00 PM, Sylvain Wallez wrote:

> Jeremy Quinn wrote:
>
> <snip/>
>
>> I just converted all my classes to use the
>> org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.FOM_Reques 
>> t. jsFunction_getParameter (String name) method, and they appear to  
>> be  working.
>>
>> Would it be 'safer' to pass the FOM_Cocoon object itself, and unwrap   
>> the org.apache.cocoon.environment.Request from it as Ugo appears to   
>> have done?
>
>
> Yep. Furthermore, you don't have to "unwrap" the request, since  
> FOM_Cocoon provides a getRequest() method that gives access to the  
> _real_ o.a.c.environment.Request object.

Thanks Sylvain

I see you are absolutely right .... on my first glance at the code it  
appeared to me that FOM_Cocoon.getRequest returned a FOM_Request ....  
thanks for clearing that up.

regards Jeremy


Re: converting FlowApp to new FOM

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Jeremy Quinn wrote:

<snip/>

> I just converted all my classes to use the
> org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.FOM_Request. 
> jsFunction_getParameter (String name) method, and they appear to be  
> working.
>
> Would it be 'safer' to pass the FOM_Cocoon object itself, and unwrap  
> the org.apache.cocoon.environment.Request from it as Ugo appears to  
> have done?


Yep. Furthermore, you don't have to "unwrap" the request, since 
FOM_Cocoon provides a getRequest() method that gives access to the 
_real_ o.a.c.environment.Request object.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Re: converting FlowApp to new FOM

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Wednesday, August 13, 2003, at 12:57 PM, Reinhard Pötz wrote:

>
> From: Jeremy Quinn
>
>> On Wednesday, August 13, 2003, at 12:47 PM, Reinhard Pötz wrote:
>>
>>> Jeremy,
>>>
>>> I've never tried it but if I understood Chris correctly you can call
>>> the
>>> method
>>>
>>> form.populate( cocoon.request);
>>>
>>> in your flow, and object of the type
>>> org.apache.cocoon.environment.Request is available in your
>> java class
>>
>> I tried that, and got this error:
>>
> "file:/Library/Tomcat/webapps/cocoon/editor/flow/Editor.js", line 189:
>> Cannot convert
>>
> org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon$FOM_Request 
> @
>
>> a14cd1 to org.apache.cocoon.environment.Request
>
>
> In the archives I found this:
> http://marc.theaimsgroup.com/?t=105977266100004&r=1&w=2
>
> and this should do it:
> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=105977306309620&w=2

I just converted all my classes to use the
org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.FOM_Request. 
jsFunction_getParameter (String name) method, and they appear to be  
working.

Would it be 'safer' to pass the FOM_Cocoon object itself, and unwrap  
the org.apache.cocoon.environment.Request from it as Ugo appears to  
have done?

Thanks

regards Jeremy


RE: converting FlowApp to new FOM

Posted by Reinhard Pötz <re...@gmx.net>.
From: Jeremy Quinn

> On Wednesday, August 13, 2003, at 12:47 PM, Reinhard Pötz wrote:
> 
> > Jeremy,
> >
> > I've never tried it but if I understood Chris correctly you can call
> > the
> > method
> >
> > form.populate( cocoon.request);
> >
> > in your flow, and object of the type 
> > org.apache.cocoon.environment.Request is available in your 
> java class
> 
> I tried that, and got this error:
> 
"file:/Library/Tomcat/webapps/cocoon/editor/flow/Editor.js", line 189:  
> Cannot convert  
>
org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon$FOM_Request@

> a14cd1 to org.apache.cocoon.environment.Request


In the archives I found this:
http://marc.theaimsgroup.com/?t=105977266100004&r=1&w=2

and this should do it:
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=105977306309620&w=2


Cheers,
Reinhard


Re: converting FlowApp to new FOM

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Wednesday, August 13, 2003, at 12:47 PM, Reinhard Pötz wrote:

> Jeremy,
>
> I've never tried it but if I understood Chris correctly you can call  
> the
> method
>
> form.populate( cocoon.request);
>
> in your flow, and object of the type
> org.apache.cocoon.environment.Request is available in your java class

I tried that, and got this error:

"file:/Library/Tomcat/webapps/cocoon/editor/flow/Editor.js", line 189:  
Cannot convert  
org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon$FOM_Request@ 
a14cd1 to org.apache.cocoon.environment.Request

regards Jeremy


RE: converting FlowApp to new FOM

Posted by Reinhard Pötz <re...@gmx.net>.
Jeremy,

I've never tried it but if I understood Chris correctly you can call the
method

form.populate( cocoon.request);

in your flow, and object of the type
org.apache.cocoon.environment.Request is available in your java class

HTH
Cheers,
Reinhard

> -----Original Message-----
> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk] 
> Sent: Wednesday, August 13, 2003 1:34 PM
> To: dev@cocoon.apache.org
> Subject: converting FlowApp to new FOM
> 
> 
> Hi All,
> 
> I am in the process of converting a flow app written for Cocoon2.1RC1 
> to the new FOM.
> 
> The first problem I face is with the Request Object.
> 
> My helper Java Classes have been written to take an 
> org.apache.cocoon.environment.Request Object, but now my flowscripts 
> are not able to pass this anymore.
> 
> public interface Form {
> 	
> 	/**
> 	 * Update the Form from the incoming Request Parameters
> 	 * @param request Cocoon Request
> 	 */	
> 	public void populate 
> (org.apache.cocoon.environment.Request request);
> 
> // snip
> }
> 
> The only methods of Request that my Classes call are to do 
> with getting 
> request parameters.
> 
> Is it safe to just convert these classes to use the 
> org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.FO
> M_Request 
> and call methods like public String jsFunction_getParameter(String 
> name) instead?
> 
> Or do I need a different approach?
> 
> thanks for any help
> 
> regards Jeremy
>