You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Thomas Kjeldahl Nilsson <tn...@marcello.no> on 2004/06/11 13:14:17 UTC
Calling the flow object model objects from java classes?
Hello,
I have some flowscripts with a lot of businesslogic in them. I really
want to limit flowscript code to "controller" code; so I'm encapsulating
the businesslogic in java objects which are called from the flowscripts.
At a few points in the java code I need to access some attributes in the
calling flowscripts current 'cocoon.session'.
I wonder if it is possible to access cocoon.session in my
"flowscript-called" java objects?
(I've tried to simply pass the FOM session to the java methods, but that
didn't work very well... :)
-Thomas Nilsson
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Some questions about continuations!
Posted by Thomas Kjeldahl Nilsson <tn...@marcello.no>.
Thanks for the quick reply, Ugo.
Bit of a head-smacking-moment for me looking at your flowscript
suggestion! "Of course!" :)
Regards,
Thomas N
Ugo Cei wrote:
> Thomas Kjeldahl Nilsson wrote:
>
>> 1: Do active continuations "time out"? In my project we have quite a
>> few pages where we in the flow do a sendPageAndWait(), then present a
>> page where the user is able to go elsewhere thus not letting the
>> current continuation finish (by calling sendPage()).
>
>
> Yes, they do expire after a timeout that is set in cocoon.xconf (search
> for the <continuations-manager> element).
>
>> What happens with this unactive continuation?
>
>
> It triggers an invalid continuation exception if invoked.
>
>> 2: In my app, when the user does something wrong when submitting a
>> form, I want to restart the function, and present the first page with
>> an error msg in at the top of the page. How best to do this?
>
>
> var error = null;
> while true() {
> cocoon.sendPageAndWait("view", { "error" : error });
> error = validateUserInput();
> if (error == null) break;
> }
>
>
> Ugo
>
> ---------------------------------------------------------------------
> 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
Re: Some questions about continuations!
Posted by Ugo Cei <u....@cbim.it>.
Thomas Kjeldahl Nilsson wrote:
> 1: Do active continuations "time out"? In my project we have quite a few
> pages where we in the flow do a sendPageAndWait(), then present a page
> where the user is able to go elsewhere thus not letting the current
> continuation finish (by calling sendPage()).
Yes, they do expire after a timeout that is set in cocoon.xconf (search
for the <continuations-manager> element).
> What happens with this unactive continuation?
It triggers an invalid continuation exception if invoked.
> 2: In my app, when the user does something wrong when submitting a form,
> I want to restart the function, and present the first page with an error
> msg in at the top of the page. How best to do this?
var error = null;
while true() {
cocoon.sendPageAndWait("view", { "error" : error });
error = validateUserInput();
if (error == null) break;
}
Ugo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Some questions about continuations!
Posted by Thomas Kjeldahl Nilsson <tn...@marcello.no>.
Hello,
A few (possibly stupid) questions on continuations:
1: Do active continuations "time out"? In my project we have quite a few
pages where we in the flow do a sendPageAndWait(), then present a page
where the user is able to go elsewhere thus not letting the current
continuation finish (by calling sendPage()).
What happens with this unactive continuation?
2: In my app, when the user does something wrong when submitting a form,
I want to restart the function, and present the first page with an error
msg in at the top of the page. How best to do this?
----
function doStuff(){
// Prepare page
cocoon.sendPageAndWait("first.xml");
// Process form submitted by user:
//IF (any errors) THEN restart doStuff(), show "first.xml" with errorMsg
// ELSE cocoon.sendPageAndWait("second.xml");
}
----
regards,
Thomas Kjeldahl Nilsson
Oslo, Norway
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Calling the flow object model objects from java classes?
Posted by Thomas Kjeldahl Nilsson <tn...@marcello.no>.
The problem looks really strange; when I rewrite the function call to
the java (class with cocoon.session as in-parameter), subsequent tests
of the website comes up with an error:
"Function "javascript:preFunction()" not found"
(preFunction() is run before all flowscripts, not just the one where I
pass the session.)
Also, I now get the same error in all flowscripts in the webapp- not
just the one where I try to pass the session. When I take away all usage
of coocon.session as a function parameter, everything works again. Strange!!
-thomas
Joerg Heinicke wrote:
> On 11.06.2004 13:14, Thomas Kjeldahl Nilsson wrote:
>
>> Hello,
>>
>> I have some flowscripts with a lot of businesslogic in them. I really
>> want to limit flowscript code to "controller" code; so I'm
>> encapsulating the businesslogic in java objects which are called from
>> the flowscripts.
>>
>> At a few points in the java code I need to access some attributes in
>> the calling flowscripts current 'cocoon.session'.
>> I wonder if it is possible to access cocoon.session in my
>> "flowscript-called" java objects?
>>
>> (I've tried to simply pass the FOM session to the java methods, but
>> that didn't work very well... :)
>
>
> That's exactly the way to go if you don't want to avalonize your Java
> methods, what would be overkill IMO. But calling your Java methods with
> cocoon.session as parameter should work, I do the same for
> cocoon.request. What's your problem with it?
>
> Joerg
>
>
> ---------------------------------------------------------------------
> 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
Re: Calling the flow object model objects from java classes?
Posted by Joerg Heinicke <jo...@gmx.de>.
On 11.06.2004 13:14, Thomas Kjeldahl Nilsson wrote:
> Hello,
>
> I have some flowscripts with a lot of businesslogic in them. I really
> want to limit flowscript code to "controller" code; so I'm encapsulating
> the businesslogic in java objects which are called from the flowscripts.
>
> At a few points in the java code I need to access some attributes in the
> calling flowscripts current 'cocoon.session'.
> I wonder if it is possible to access cocoon.session in my
> "flowscript-called" java objects?
>
> (I've tried to simply pass the FOM session to the java methods, but that
> didn't work very well... :)
That's exactly the way to go if you don't want to avalonize your Java
methods, what would be overkill IMO. But calling your Java methods with
cocoon.session as parameter should work, I do the same for
cocoon.request. What's your problem with it?
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org