cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Poetz <reinh...@apache.org>
Subject Re: 2.2 - problem with session between blocks - no access to session from block dependency
Date Mon, 10 Mar 2008 06:53:54 GMT
Josh2007 wrote:
> Hello all,
> 
> I have a problem using session between blocks.
> I have to block Block1 and Block2 with Block1 having a dependency on Block2.
> To connect the blocks I make use of ServletService and everything works just
> fine, except for the session.
> 
> case 1:
> If I create a session and set up a session-attribute in block1, I can't get
> access to it from block2 while performing [mvn jetty:run] on Block1
> (sessionAttributeGenerator output only the empty "root" element).
> 
> case 2:
> If I create a session and set up a session-attribute in Block 2 this time, I
> can't output the session-attribute while performing [mvn jetty:run] on
> Block1 (sessionAttributeGenerator output only the empty "root" element).
> 
> Of course if I perform [mvn jetty:run] on Block2, I get my
> session-attribute.
> 
> **************
> 
> It seems to me, if I run Block1 no session functionalities are allowed in
> blocks dependencies.
> Is there any way to get access to session from dependencies?
> I have an xml configuration file set up in Block1 which need to be available
> on regular basis for Block2 without passing it, each time, as POST with
> ServletService. 
> 
> My idea is to save this small file in the session for the time of the
> processing.

The session handling was changed in trunk some time ago: every servlet service 
now gets access to the global session. Before the change every servlet-service 
call used its own session which led to the behaviour you described above.

The upcoming release will contain the change and will make your use case work 
(IIUC).

Though be aware that you introduce an implicit contract between your 
servlet-service (i.e. one servlet-service only works if another servlet-service 
has put something into the session before).

-- 
Reinhard Pötz                            Managing Director, {Indoqa} GmbH
                           http://www.indoqa.com/en/people/reinhard.poetz/

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member, PMC Chair        reinhard@apache.org
_________________________________________________________________________

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


Mime
View raw message