tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: question about Tomcat5.5 getServletContext().getContext(String url);
Date Wed, 23 Dec 2009 16:15:54 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 12/22/2009 4:35 AM, André Warnier wrote:
> In other words, [that code] is trying to get the context of a webapp which should
> be located at webapps/File.
> If you do not have such a webapp, then that is the reason for the
> message above.

Tomcat requires a webapp to be configured as "cross-context" enabled in
order to grab the ServletContext from another webapp. If this webapp
isn't cross-context-enabled, then you'll get 'null' whether that webapp
exists or not.

See http://tomcat.apache.org/tomcat-6.0-doc/config/context.html for more
information. Specifically, search for "crossContext" within that page.

> Why it is doing that however, and whether it is a problem, is something
> you will need to ask from the author of the application.

+1

It's not often that you need to grab another webapp's ServletContext,
unless you want to to a server-side forward across webapps. Unless you
have a particular requirement to do this, I would recommend that the OP
de-couple the two (or more?) webapps by using a client-side redirect
instead of a server-side forward.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksyQjoACgkQ9CaO5/Lv0PAy8QCgp2P7ADzN7WDVwOiAh6S5WqIW
WcoAn36OobTlKOxp/9cP2hZH6nuRzGBz
=e7W0
-----END PGP SIGNATURE-----

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


Mime
View raw message