cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <KPiroum...@flagship.ru>
Subject Re: cocoons ServletContext
Date Fri, 01 Mar 2002 16:54:27 GMT
>
> Lai, Harry wrote:
>
> >Hi Yury,
> >
> >Within the act method, you can access the cocoon ServletContext via the
> >objectModel parameter.  Just use the constants in
> >org.apache.cocoon.Constants.  For example:
> >
> > Context cocoonServContext = (Context)
> >objectModel.get(Constants.CONTEXT_OBJECT);
> >
> >Note that this is the Cocoon context wrapper (defined in
> >org.apache.cocoon.environment) for the actual HTTP Servlet Context.  If
you
> >need the actual HTTP Servlet Context (defined in javax.servlet), you can
use
> >the constants defined in
org.apache.cocoon.environment.http.HttpEnvironment.
> >For example:
> >
> > ServletContext servContext = (ServletContext)
> >objectModel.get(HttpEnvironment.HTTP_SERVLET_CONTEXT);
> >
> ServletContext servContext = (ServletContext)
> objectModel.get(HttpEnvironment.HTTP_SERVLET_CONTEXT);
>
> HttpEnviroment... Thats Ok with me :)

Cocoon's wrapper of environment contains HttpEnvironment if you are running
in a servlet environment. If you run your code in a command line then you
will get null. Cocoon's context wrapper should be used to avoid problems in
different environments.

If you don't need Http specific features then there is no need to use it.

Regards,
    Konstantin

> Thanx Harry!
>
> >
> >Hope that helps!
> >
> >Harry
> >
> >
> >-----Original Message-----
> >From: yuryx [mailto:yuryx@mobicomk.donpac.ru]
> >Sent: Friday, March 01, 2002 10:32 AM
> >To: cocoon-users@xml.apache.org
> >Subject: cocoons ServletContext
> >
> >
> >Hi all!
> >
> >Can anyone help me with the following problem:
> >How can I get into my cocoon's 'action' a pointer to cocoon
ServletContext?
> >Is it possible? What shall I use in my 'action'?
> >
> >Thanx.
> >Yury.
> >
> >
> >
> >---------------------------------------------------------------------
> >Please check that your question has not already been answered in the
> >FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> >To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> >For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> >
> >---------------------------------------------------------------------
> >Please check that your question has not already been answered in the
> >FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> >To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> >For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> >
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Mime
View raw message