Re: [Rife-users] How to check if the current element is part of a continuation

2007-05-19 Thread Geert Bevin

Cool, that should work too :-)

On 20 May 2007, at 00:35, Eddy Young wrote:



On 19 May 2007, at 20:57, Geert Bevin wrote:


Hmm, makes sense.

One thing that could work is to obtain the active continuation  
context : ContinuationContext.getActiveContext()


Then you can call getContinuable() (which is the element,  
actually) and see if it corresponds to the current one.


Thanks, Geert.

I found it easier to check if there is a call stack on the active  
context, like this:


if (ContinuationContext.getActiveContext().getActiveCallState() !=  
null) {

answer(); // go back to caller
} else {
// display welcome
}


--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


___
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users


Re: [Rife-users] How to check if the current element is part of a continuation

2007-05-19 Thread Eddy Young


On 19 May 2007, at 20:57, Geert Bevin wrote:


Hmm, makes sense.

One thing that could work is to obtain the active continuation  
context : ContinuationContext.getActiveContext()


Then you can call getContinuable() (which is the element, actually)  
and see if it corresponds to the current one.


Thanks, Geert.

I found it easier to check if there is a call stack on the active  
context, like this:


if (ContinuationContext.getActiveContext().getActiveCallState() !=  
null) {

answer(); // go back to caller
} else {
// display welcome
}

Eddy
___
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users


Re: [Rife-users] How to check if the current element is part of a continuation

2007-05-19 Thread Geert Bevin

Hmm, makes sense.

One thing that could work is to obtain the active continuation  
context : ContinuationContext.getActiveContext()


Then you can call getContinuable() (which is the element, actually)  
and see if it corresponds to the current one.


On 19 May 2007, at 15:51, Eddy Young wrote:


Yes, it does.

In the FORM, there is a hidden input called "contid". Maybe it  
happens only when there is a FORM element?


Eddy

On 18 May 2007, at 17:40, Geert Bevin wrote:

Hmm, I'll have to trace this. It doesn't create a continuation,  
but it might pickup the one that is active from the call element.  
Are you sure that when you run the element with the answer method  
directly, that getContinuationId gives you a result?


On 18 May 2007, at 18:15, Eddy Young wrote:


Quoting Geert Bevin <[EMAIL PROTECTED]>:


Continuations are only active for elements that use
continuations-related calls like pause(), call() and stepback().  A
continuation ID will only be available for those elements that have
these methods. Answer doesn't cause a continuation to be created, I
think.


Hmmm... "answer()" appears to be creating a continuation. At  
least, with the latest 1.6 snapshot.


--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


___
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users


Re: [Rife-users] How to check if the current element is part of a continuation

2007-05-18 Thread Geert Bevin
I'm not sure that the continuation id will be a good indication, as  
every request is technically part of a continuation. So, it will  
always appear as though the "login" element is executing as a  
continuation step.


Continuations are only active for elements that use continuations- 
related calls like pause(), call() and stepback().  A continuation ID  
will only be available for those elements that have these methods.  
Answer doesn't cause a continuation to be created, I think.


Would it be possible to have a sketch of what a continuation tree  
looks like? I think that would clarify a lot of things.


No pressure, though. I know you're a busy man :-)


If you're using the 1.6 nightly builds,  
ContinuationContext.getActiveContext() and use getParentContext() to  
walk the tree upward, if you want.


That's all the help I can give you want 'sketching the tree' atm,  
sorry. :-/


--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


___
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users


Re: [Rife-users] How to check if the current element is part of a continuation

2007-05-18 Thread Eddy Young

Quoting Geert Bevin <[EMAIL PROTECTED]>:


Hi Eddy,

this should help:

http://rifers.org/docs/api/com/uwyn/rife/engine/ElementSupport.html#getContinuationId()

Take care,

Geert


Thanks for the quick reply, Geert.

I'm not sure that the continuation id will be a good indication, as  
every request is technically part of a continuation. So, it will  
always appear as though the "login" element is executing as a  
continuation step.


Would it be possible to have a sketch of what a continuation tree  
looks like? I think that would clarify a lot of things.


No pressure, though. I know you're a busy man :-)

Eddy
___
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users


Re: [Rife-users] How to check if the current element is part of a continuation

2007-05-18 Thread Geert Bevin

Hi Eddy,

this should help:

http://rifers.org/docs/api/com/uwyn/rife/engine/ 
ElementSupport.html#getContinuationId()


Take care,

Geert

On 18 May 2007, at 16:19, Eddy Young wrote:


Hello,

Does anyone know how to check if the current element is being  
processed as part of a continuation?


I have a "login" element that either calls "answer()" or display a  
content block, depending on whether it was called with "call()" or  
accessed directly. In order to do that, it needs to know whether it  
is being called as part of a continuation or not.


I suspect the solution lies in checking some properties of the  
active context (ContinuationContext.getActiveContext()), but I  
cannot seem to put my finger on it.


Any ideas?

Thanks,

Eddy
___
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users



--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


___
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users


[Rife-users] How to check if the current element is part of a continuation

2007-05-18 Thread Eddy Young

Hello,

Does anyone know how to check if the current element is being  
processed as part of a continuation?


I have a "login" element that either calls "answer()" or display a  
content block, depending on whether it was called with "call()" or  
accessed directly. In order to do that, it needs to know whether it is  
being called as part of a continuation or not.


I suspect the solution lies in checking some properties of the active  
context (ContinuationContext.getActiveContext()), but I cannot seem to  
put my finger on it.


Any ideas?

Thanks,

Eddy
___
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users