You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Stefano Mazzocchi <st...@apache.org> on 2004/12/15 17:57:31 UTC

what happened to the global flow variables mapped to the session?

I migrated an application that I wrote 18 months ago over to the latest 
trunk and here are the incompatible things:

  1) Rhino 1.6 is a lot more strict when you don't use "var" in front of 
a variable declaration. The previous version of Rhino was more tolerant. 
Not a problem but there is no back compatibility.

  2) it used to be that in order to have global variable persist across 
calls even without continuations, you called cocoon.createSession() and 
the flow put those values in the session. Then it was removed and done 
automatically. Now, I can't find a way to make it work.

So, is anybody able to persist global flow variables across 
non-continuated flow executions?

-- 
Stefano.


Re: what happened to the global flow variables mapped to the session?

Posted by Stefano Mazzocchi <st...@apache.org>.
Sylvain Wallez wrote:
> Stefano Mazzocchi wrote:
> 
>> I migrated an application that I wrote 18 months ago over to the 
>> latest trunk and here are the incompatible things:
>>
>>  1) Rhino 1.6 is a lot more strict when you don't use "var" in front 
>> of a variable declaration. The previous version of Rhino was more 
>> tolerant. Not a problem but there is no back compatibility.
> 
> 
> 
> This is not related to Rhino, but to the way we handle the global scope. 
> JavaScript states that if an unknown variable is used, it is attached to 
> the global scope if it's not declared with "var" and to the local scope 
> otherwise.
> 
> The problem is that both syntaxes (with and without "var) are correct, 
> but lead to very different lifecycles of variables, especially when 
> continuations are used. I added [1] this stricter behaviour after having 
> spent half a day chasing a bug that was just a few "var" missing here 
> and there in flowscript files. Several other people reported problems on 
> the lists that were related to this implicit attachment of variables to 
> the global scope.

Gotcha! makes sense. We should really document this somewhere (I might 
wikify my experience later today).

>>  2) it used to be that in order to have global variable persist across 
>> calls even without continuations, you called cocoon.createSession() 
>> and the flow put those values in the session. Then it was removed and 
>> done automatically. Now, I can't find a way to make it work.
> 
> 
> 
> ??? I'm using this daily and it works fine ???
> 
>> So, is anybody able to persist global flow variables across 
>> non-continuated flow executions?
> 
> 
> 
> Well, that *should* work...

Turns out I'm an idiot! (as usual, my day job is turning me into a 
sloppy scientist ;-)

Flow *was* persisting the variables, it was jetty that was invalidating 
the session everytime because I didn't modify the cookie path and I was 
proxy-passing it. So, when on my machine worked fine (jetty directly) 
and on the remote site it didn't (proxy-passed), I started to understand.

Sorry for the noise, folks.

-- 
Stefano.


Re: what happened to the global flow variables mapped to the session?

Posted by Sylvain Wallez <sy...@apache.org>.
Stefano Mazzocchi wrote:

> I migrated an application that I wrote 18 months ago over to the 
> latest trunk and here are the incompatible things:
>
>  1) Rhino 1.6 is a lot more strict when you don't use "var" in front 
> of a variable declaration. The previous version of Rhino was more 
> tolerant. Not a problem but there is no back compatibility.


This is not related to Rhino, but to the way we handle the global scope. 
JavaScript states that if an unknown variable is used, it is attached to 
the global scope if it's not declared with "var" and to the local scope 
otherwise.

The problem is that both syntaxes (with and without "var) are correct, 
but lead to very different lifecycles of variables, especially when 
continuations are used. I added [1] this stricter behaviour after having 
spent half a day chasing a bug that was just a few "var" missing here 
and there in flowscript files. Several other people reported problems on 
the lists that were related to this implicit attachment of variables to 
the global scope.

>  2) it used to be that in order to have global variable persist across 
> calls even without continuations, you called cocoon.createSession() 
> and the flow put those values in the session. Then it was removed and 
> done automatically. Now, I can't find a way to make it work.


??? I'm using this daily and it works fine ???

> So, is anybody able to persist global flow variables across 
> non-continuated flow executions?


Well, that *should* work...

Sylvain

[1] http://marc.theaimsgroup.com/?t=109896790100003&r=1&w=2

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Re: what happened to the global flow variables mapped to the session?

Posted by Ralph Goers <Ra...@dslextreme.com>.
Stefano Mazzocchi said:
> I migrated an application that I wrote 18 months ago over to the latest
> trunk and here are the incompatible things:
>
>   1) Rhino 1.6 is a lot more strict when you don't use "var" in front of
> a variable declaration. The previous version of Rhino was more tolerant.
> Not a problem but there is no back compatibility.
>
>   2) it used to be that in order to have global variable persist across
> calls even without continuations, you called cocoon.createSession() and
> the flow put those values in the session. Then it was removed and done
> automatically. Now, I can't find a way to make it work.
>
> So, is anybody able to persist global flow variables across
> non-continuated flow executions?

I believe I saw this on the users list the other day and as I recall, the
answer was that it happens automatically when you make it a class member
variable.

Ralph