Hello Emond! Thank your for your swift reply.
> > I need to:
> >
> > 1. create a continuation
> > 2. put the id of the continuation in a deliveryUrl
> > 3. redirect to a redirectUrl
> > 4. suspend flowscript execution, until the remote system hosting
> > redirectUrl redirects the user to my deliveryUrl
> > 5. resume from here (by sitemap-catching the deliveryUrl
> continuation id,
> > continuing the flowscript execution)
> >
> >
> > Is this possible? I tried to read
> > http://cocoon.apache.org/2.1/userdocs/flow/api.html on how creating
> > WebContinuations manually affect execution, but it doesn't say
> how and if I
> > could halt execution.
>
> What you need is a 'redirectAndWait'. This is something that IMHO
> is missing
> in the current flow API, but very easy to implement. I don't have
> the cocoon
> source here at the moment, but take a look at the
> 'sendPageAndWait' method in
> the flow implementation you are using (probably javascript). This method
> should call 'sendPage' and some other stuff. The
> 'redirectAndWait' method you
> need will contain a 'redirect' (or is it 'redirectTo'?) and this
> other stuff.
> That's all you need.
>
> A custom flow engine I'm working on as an example:
> public void sendPageAndWait(String uri, Object bizdata) {
> sendPage(uri, bizdata);
> getCont().endExecution(null);
> }
>
> public void redirectAndWait(String uri) {
> redirectTo(uri);
> getCont().endExecution(null);
> }
>
> Good luck,
> Emond
Looking at
cocoon\build\cocoon-2.1.5.1\classes\org\apache\cocoon\components\flow\javasc
ript\fom\fom_system.js, the sendPageAndWait method is really a sendPage call
with some extra stuff, just like you said:
FOM_Cocoon.suicide = new Continuation();
FOM_Cocoon.prototype.sendPageAndWait = function(uri, bizData, fun, ttl) {
this.sendPage(uri, bizData,
new FOM_WebContinuation(new Continuation(),
this.continuation, ttl));
if (fun) {
if (!(fun instanceof Function)) {
throw "Expected a function instead of: " + fun;
}
fun();
}
FOM_Cocoon.suicide();
}
It seems it's FOM_Cocoon.suicide(); that halts execution (duh). I tried
using this:
function testingSome() {
var c = cocoon.createWebContinuation();
print("Continuation = " + c.id);
FOM_Cocoon.suicide();
print("Continued executing.");
}
When I call this test method, it displays a continuation id and then halts.
When I call the continuation using the print'ed continuation id to resume
execution, it seems it's picking up execution right after the
createWebContinuation() call, which means it only prints the "Continuation =
<id>" again and then executes suicide - whereas I wanted it to pick up right
after its suicide line and print the "Continued executing." part.
I guess I'm supposed to use this in some other way, but I'm not that
familiar with flowscript. What am I doing wrong?
regards,
Ulf Sahlin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]