You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Leszek Gawron <lg...@mobilebox.pl> on 2004/07/22 12:13:48 UTC

Re: Getting the ServiceManager from Request?

cocoon-dev@kuhnle.net wrote:
> Hi,
> 
> how can I access the ServiceManager when I only have Request as an entry 
> point?
> 
> Regards,
> Jochen
no you cannot ... please state what and where you need it for (flow, 
actions, components)

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65


Re: Getting the ServiceManager from Request?

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Jochen Kuhnle wrote:
> I am working on a "ExtendedFormManager" which groups a form, several 
> bindings and data models together. The use case is to specify e.g. a form 
> which initializes from a "database model" with binding A and upon submit 
> stores itself into the "database model" with binding B and additionally 
> into a "mailto model" with binding C, thus storing and sending an email. 
> The "ExtendedFormManager" should manage the whole thing together as 
> painlessly as possible, it should be a Service, and should be created from 
> a configuration file automatically when a form is needed.
> 
> One Situation is in the form template, where you get the form through a 
> JXPath expression. Something like the following would be nice there:
> 
> <ft:form-template location="ExtendedFormManagerHelper.getForm($request, 
> 'MyExtendedForm')"> 
> 
> where ExtendedFormManagerHelper.getForm is a static method that does the 
> Service lookup and initialization.
> 
> For this to work, I need to get the ServiceManager in order to get to my 
> ExtendedFormManager Service. According to the code 
> (FormsPipelineConfig.createConfig), the JXPath context only has variables 
> for continuation, request, session and parameters.
so obtain this extended form manager in flow :

form.setBookmark();
var mgr = cocoon.getComponent( ExtendedFormManager.ROLE );
form.showForm( "myview", { mgr: mgr } );

There is somethink like form bookmark which stores the continuation to 
restart the form. So every time your form gets show a new manager is 
being looked up. You should release this manager after every form 
roundtrip (really do not know how to do it here - you might have to 
change Form.js).

then do it like this:
<ft:form-template location="mgr.getForm($request, 'MyExtendedForm')">

HTH

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65


Re: Getting the ServiceManager from Request?

Posted by Jochen Kuhnle <co...@kuhnle.net>.
I am working on a "ExtendedFormManager" which groups a form, several 
bindings and data models together. The use case is to specify e.g. a form 
which initializes from a "database model" with binding A and upon submit 
stores itself into the "database model" with binding B and additionally 
into a "mailto model" with binding C, thus storing and sending an email. 
The "ExtendedFormManager" should manage the whole thing together as 
painlessly as possible, it should be a Service, and should be created from 
a configuration file automatically when a form is needed.

One Situation is in the form template, where you get the form through a 
JXPath expression. Something like the following would be nice there:

<ft:form-template location="ExtendedFormManagerHelper.getForm($request, 
'MyExtendedForm')"> 

where ExtendedFormManagerHelper.getForm is a static method that does the 
Service lookup and initialization.

For this to work, I need to get the ServiceManager in order to get to my 
ExtendedFormManager Service. According to the code 
(FormsPipelineConfig.createConfig), the JXPath context only has variables 
for continuation, request, session and parameters.





Leszek Gawron <lg...@mobilebox.pl> 
22.07.2004 15:13
Please respond to
dev@cocoon.apache.org


To
dev@cocoon.apache.org
cc

Subject
Re: Getting the ServiceManager from Request?






Jochen Kuhnle wrote:
> I need it in a JXPath expression, where the JX context ist created by 
> cocoon (cform's binding manager), and this context does not contain the 
> service manager.

are you talking about custom binding? if so you can implement it in 
javascript and you do not need a service manager because you could do 
cocoon.getComponent

but I may be wrong


-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65




Re: Getting the ServiceManager from Request?

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Jochen Kuhnle wrote:
> I need it in a JXPath expression, where the JX context ist created by 
> cocoon (cform's binding manager), and this context does not contain the 
> service manager.

are you talking about custom binding? if so you can implement it in 
javascript and you do not need a service manager because you could do 
cocoon.getComponent

but I may be wrong


-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65


Re: Getting the ServiceManager from Request?

Posted by Jochen Kuhnle <co...@kuhnle.net>.
I need it in a JXPath expression, where the JX context ist created by 
cocoon (cform's binding manager), and this context does not contain the 
service manager.

Regards,
Jochen




Leszek Gawron <lg...@mobilebox.pl> 
22.07.2004 12:13
Please respond to
dev@cocoon.apache.org


To
dev@cocoon.apache.org
cc

Subject
Re: Getting the ServiceManager from Request?






cocoon-dev@kuhnle.net wrote:
> Hi,
> 
> how can I access the ServiceManager when I only have Request as an entry 

> point?
> 
> Regards,
> Jochen
no you cannot ... please state what and where you need it for (flow, 
actions, components)

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65