You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nicolas Bielza <ni...@alligacom.com> on 2004/02/19 22:34:29 UTC

Passing objects into the cocoon (bean) environment

Hi,
 
I'm using cocoon through the CocoonBean and I need to "see" some objects
from my application inside a XSP. Is there a way of placing some objects
inside the environment of the CocoonBean ? Something that would look
like the VelocityContext in Velocity...
 
The idea is that I need to use some kind of HttpServletRequest to
generate the pages, but it's not a real HttpServletRequest and I don't
feel like turning my application into a servlet container. So, I can't
use the CocoonServlet and I think that means I can't use the xsp-request
logic sheet, or am I wrong ?
 
I'm thinking of accessing a static Map and getting the objects using a
(session) key; the session key could be encoded in the URI... (I'm
calling the processURI() method from the CocoonWrapper)
 
Can someone tell me if there's a better solution to this problem ?
 
Thanks,
Nicolas

Re: Passing objects into the cocoon (bean) environment

Posted by Upayavira <uv...@upaya.co.uk>.
Nicolas Bielza wrote:

> Hi,
>  
> I'm using cocoon through the CocoonBean and I need to "see" some 
> objects from my application inside a XSP. Is there a way of placing 
> some objects inside the environment of the CocoonBean ? Something that 
> would look like the VelocityContext in Velocity...
>  
> The idea is that I need to use some kind of HttpServletRequest to 
> generate the pages, but it's not a real HttpServletRequest and I don't 
> feel like turning my application into a servlet container. So, I can't 
> use the CocoonServlet and I think that means I can't use the 
> xsp-request logic sheet, or am I wrong ?
>  
> I'm thinking of accessing a static Map and getting the objects using a 
> (session) key; the session key could be encoded in the URI... (I'm 
> calling the processURI() method from the CocoonWrapper)
>  

Statics would do it, but that's a real hack. How's about providing a 
patch to the CocoonWrapper that allows you to pass to it a 
CommandLineContext of your own creation, instead of having the 
initialise method create one for you. So long as it still works as it 
does currently, but can also do what you need...

In the context of the CLI/bean, the CommandLineContext is the equivalent 
of the servlet context - thus you can add attributes as you would the 
servlet context.

> Can someone tell me if there's a better solution to this problem ?

Yes, provide a patch.

Regards, Upayavira



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