Hey,
  What if we change the scenario a little bit.  Is is possible to share
objects between contexts that reside in differant <host>
blocks?  getContext() does not seem to work in that scenario.

-Chad Johnson

On Fri, 11 Jan 2002, Craig R. McClanahan wrote:

> Containers are not required to let you call ServletContext.getContext()
> and get a non-null value -- it is allowed to return null for all requests
> (for security reasons).  For Tomcat 4, the default is to disallow this
> kind of access, but you can turn it off (with the crossContext attribute).
> Other servers may or may not let you enable this facility.
> 
> Even if you get the reference to the other ServletContext, I would be more
> concerned about your reliance on getRealPath() at all -- which implies
> that you are going to use file I/O to retrieve static resources from
> within the "other" webapp.  This won't work at all when the application is
> *not* run from an unpacked directory -- you should use
> ServletContext.getResource() or ServletContext.getResourceAsStream()
> instead for maximum portability.
> 
> Craig


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to