You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sumedh Shirodkar <su...@hotmail.com> on 2006/10/10 22:02:12 UTC

Application Scope variable

All,

I am a total newbie to cocoon and am a bit confused out here.
We are using cocoon to interact with documentum. Documentum creates a 
session manager that handles all future documentum sessions. If a session is 
already alive, it can pass that on...if

Now, we need a way to keep this session manager somewhere so that it can be 
accessed by any class in the cocoon web-application.

how should I go about it? where should this session manager variable be 
stored?

thanks

-S.

_________________________________________________________________
Express yourself - download free Windows Live Messenger themes! 
http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/themes/vibe/default.aspx?locale=en-us&source=hmtagline


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


Re: Application Scope variable

Posted by Joerg Heinicke <jo...@gmx.de>.
On 10.10.2006 22:02, Sumedh Shirodkar wrote:

> We are using cocoon to interact with documentum. Documentum creates a 
> session manager that handles all future documentum sessions. If a 
> session is already alive, it can pass that on...if
> 
> Now, we need a way to keep this session manager somewhere so that it can 
> be accessed by any class in the cocoon web-application.
> 
> how should I go about it? where should this session manager variable be 
> stored?

This heavily depends on the scope of the variable. It will be easy if 
your understanding of application scope matches one of the standard 
servlet scopes: request, session and application. If I understand you 
correctly there is one Documentum session (or session manager?) for the 
whole life time of the Cocoon servlet. So a servlet context attribute 
seems to be the most appropriate. If it is also one Documentum session 
per webapp session the session attribute seems to be the best.

But both servlet context and session are not simply available in any 
class in the webapp. You must retrieve them, e.g. via Cocoon's object 
model. Your classes must therefore implement Contextualizable if they 
are not sitemap components.

Another solution would be to use a RequestListener and a ThreadLocal in 
a static field of a helper class, which could be accessed from "anywhere".

Jörg

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