You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Textor <jc...@gmx.de> on 2005/06/15 09:07:03 UTC

Flowscript, global Object()

Hi List,

I've noticed a behaviour in Flowscript that seems somewhat
strange to me, but before thinking it is a bug I'd like to ask
around if someone thinks that this actually makes sense.

As we all know, global variables in Flowscript correspond to the
User's Session. This should lead to the creation of a session whenever
a global variable is modified, i.e. as in

var gl = 5;

function a(){
    cocoon.sendPage("pipe1",gl:gl);
}

function b(){
    gl = 10;
    cocoon.sendPage("pipe2");
}

Now, when calling b and then a, a Session is created for the user
to store the change to the global Variable gl.

Strangely, this does not work for composed objects as in

var settings = new Object();
settings.itemsPerPage = 5;

function a(){
    cocoon.sendPage("pipe1",settings:settings);
}

function b(){
    settings.itemsPerPage = 10;
    cocoon.sendPage("pipe2");
}

Now, when calling b and then a, no Session will be created. But when
adding a *simple* global variable as in

var settings = new Object();
settings.itemsPerPage = 5;
var gl = 1;

function a(){
    cocoon.sendPage("pipe1",settings:settings);
}

function b(){
    settings.itemsPerPage = 10;
    gl = 2;
    cocoon.sendPage("pipe2");
}

a Session will be created, and the changes for gl *and* settings will be
saved in it !

I find this somehow confusing, because you can store an Object() in the
session, but moifiying an Object() will not lead to the creation of a 
session.
This behaviour was found in cocoon 2.1.7 with Jetty as a Servlet container,
tried both with cookie- and encode-url-based sessions.

Is this a Bug ? Or am I missing something ?

Cheers,
Johannes


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