>
> 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:[EMAIL PROTECTED]]
> >Sent: Friday, March 01, 2002 10:32 AM
> >To: [EMAIL PROTECTED]
> >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: <[EMAIL PROTECTED]>
> >For additional commands, e-mail: <[EMAIL PROTECTED]>
> >
> >---------------------------------------------------------------------
> >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: <[EMAIL PROTECTED]>
> >For additional commands, e-mail: <[EMAIL PROTECTED]>
> >
>
>
>
>
> ---------------------------------------------------------------------
> 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: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>

---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to