cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Fagerstrom <dani...@nada.kth.se>
Subject Re: flowscript save-on-back
Date Thu, 05 Dec 2002 11:21:40 GMT
Christopher Oliver wrote:

> Ovidiu,
>
> I think the below would also work, without changing system.js or any 
> Java code by using Rhino with continuations extended JavaScript syntax:
>
> catch (continue) {
> // The continuation I'm part of is about to be restored
> // code to handle that goes here.
> }
>
> catch (break) {
> // I'm about to be captured in a continuation
> // code to handle that goes here
> }
>
>
> Regards,
>
> Chris 

Interesting!! Could you tell a litle bit more about how this construct 
works? What corresponds to the try block in ordinary exception handling

> function multiPageForm()
> {
> var a, b, c;
>
> // Reset the local variables with form parameters from
> // the request if this call frame is part of a
> // continuation being restored.
> catch (continue)
> {
> a = cocoon.request.get("a");
> b = cocoon.request.get("b");
> c = cocoon.request.get("c");
> }
>
> sendPageAndWait("page1.html", {...});'
>
> // at this point 'a' contains the value of the request parameter
>
> ....
>
> sendPageAndWait("page2.html", {...});
>
> // at this point 'a' and 'b' contain the values of the request parameters
>
> ....
>
> sendPageAndWait("page3.html", {...});
>
> // at this point 'a'. 'b' and 'c' contain the values of the request 
> parameters
>
> ....
> } 

IMHO the above code is complicated to follow and requires good knowledge 
about how continuations work to be graspable. I prefer the construction 
Ovidius construction proposed as it abstracts away the use of 
continuations. Futhermore, in general one need different code for 
collecting request parameters for different form pages.

What about implementing Ovidius construction with the concepts you 
described? Maybe something like the following could work:

// Similar to sendPage() in system.js
function formSendPageAndWait(uri, bizData, collectRequestParametersFun, 
timeToLive)
{
catch (continue) {
collectRequestParametersFun();
}
return sendPageAndWait(uri, bizData, collectRequestParametersFun, 
timeToLive);
}

Regards,
Daniel Fagerstrom



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


Mime
View raw message