-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 11/30/12 3:00 PM, Caldarale, Charles R wrote:
>> From: Terence M. Bandoian [mailto:tere...@tmbsw.com] Subject:
>> Context Path for a subdirectory
> 
>>> A webapp can never be nested inside another, so what you're
>>> trying to do is nonsensical.
> 
>> I don't mean to be argumentative but, with Tomcat 6.0.29, I found
>> that static files from an images subdirectory of a web
>> application were not cached by Internet Explorer 7.  As a
>> workaround, I created a context for the images subdirectory and
>> left it nested in the web application.  The files from that
>> directory were then cached by IE7.  The difference was that the
>> following response headers were included when there was no 
>> separate context defined for the subdirectory:
> 
>> Pragma: No-cache Cache-Control: no-cache Expires: Wed, 31 Dec
>> 1969 18:00:00 CST
> 
>> I realize this is a non-standard configuration but it worked with
>> 6.0.29 and 6.0.35.
> 
> It may accidentally work in some versions, but it is in no way a 
> supported configuration.

I don't think it's specifically /un/supported.

For instance, Tomcat should happily deploy both of these files:

myapp.war
myapp#static.war

Requests to /myapp/static/... will be directed to the "inner" context
while those that match /myapp/* but not /myapp/static/* will be
directed to the "outer" one. I was actually waiting for someone to
point out to the OP that the Tomcat documentation originally
referenced was talking about context-name-matching (to choose a
context) and not matching a servlet directly from the URI.

The (subtle) point is that Tomcat first has to decide which context
should handle the request, and the entire URI need not be used for
that: only the context-path portion of that, which is typically the
string before the second '/' in the URL (like 'foo' for
http://www.example.com/foo/). The documentation states that the
decision is made based upon longest-match at the /context/ level, not
at the servlet level (though longest-match is also done at the servlet
level once the context has been chosen).

Thus, I believe Tomcat technically fully-supportd "nested" contexts.

Note that there are many dragons lurking in this area. Notable ones
include overlapping URI-spaces for session ids. If you need sessions
in both webapps, you (and your code) are eventually going to get confused.

> I think the effort would be better spent in figuring out how to 
> control the headers properly rather than inventing something that
> is known to be contrary to the spec.

I wouldn't say that this is contrary to the spec. Just not ....
well-tested.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlC5LbEACgkQ9CaO5/Lv0PASQACgigIn6sKQBQty4ohANPvPoxQf
/IEAn3U/5UO81KG/qHFutEQn93fjE/xj
=Wjuf
-----END PGP SIGNATURE-----

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

Reply via email to