You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Imran Pariyani <ip...@triplemind.com> on 2008/06/03 16:49:55 UTC

Getting the request object in a class implementing Listener interface cocoon 2.2

Hi all,

for the old cocoon i.e 2.1.x we use to access the request object inside 
the ActionListener implementation class with the following code ..

final Request request = 
ObjectModelHelper.getRequest(CocoonComponentManager.getCurrentEnvironment()
                    .getObjectModel());

for cocoon 2.2 can i use the following code to access the request object

ProcessInfoProvider processInfoProvider = (ProcessInfoProvider) 
WebAppContextUtils
                    
.getCurrentWebApplicationContext().getBean(ProcessInfoProvider.ROLE);
            final Map objectModel = processInfoProvider.getObjectModel();
            final Request request = 
ObjectModelHelper.getRequest(objectModel);

or there is some other way to get the instance of the request object ?

Regards

Imran



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


Re: Getting the request object in a class implementing Listener interface cocoon 2.2

Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Imran Pariyani pisze:
> Hi all,
> 
> for the old cocoon i.e 2.1.x we use to access the request object inside 
> the ActionListener implementation class with the following code ..
> 
> final Request request = 
> ObjectModelHelper.getRequest(CocoonComponentManager.getCurrentEnvironment()
>                    .getObjectModel());
> 
> for cocoon 2.2 can i use the following code to access the request object
> 
> ProcessInfoProvider processInfoProvider = (ProcessInfoProvider) 
> WebAppContextUtils
>                    
> .getCurrentWebApplicationContext().getBean(ProcessInfoProvider.ROLE);
>            final Map objectModel = processInfoProvider.getObjectModel();
>            final Request request = 
> ObjectModelHelper.getRequest(objectModel);
> 
> or there is some other way to get the instance of the request object ?

The better approach is to avoid using ObjectModelHepler and access Request bean directly:

WebAppContextUtils.getCurrentWebApplicationContext().getBean(javax.servlet.http.HttpServletRequest.getClass().getName());

-- 
Grzegorz Kossakowski

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