Discussion:
Contexts: can there be a hierarchy?
James H. H. Lampert
2018-08-23 00:35:30 UTC
Permalink
Ladies and Gentlemen:

Suppose we have a Tomcat 8 server, "https://xyz.example" for argument's
sake, running on Debian (with all of the weird, decentralized file
locations that entails).

Is there a way to set up contexts in a hierarchy, such that requests for
"https://xyz.example/foo/ham," "https://xyz.example/foo/spam," and
"https://xyz.example/foo/eggs" go to distinct webapp contexts?

--
JHHL

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Caldarale, Charles R
2018-08-23 02:18:35 UTC
Permalink
Subject: Contexts: can there be a hierarchy?
Suppose we have a Tomcat 8 server
Let's hope that's Tomcat 8.5, since 8.0 has reached EOL.
Is there a way to set up contexts in a hierarchy, such that requests for
"https://xyz.example/foo/ham," "https://xyz.example/foo/spam," and
"https://xyz.example/foo/eggs" go to distinct webapp contexts?
Not really a hierarchy, but just name your .war files (or directories)
appropriately:
foo#ham[.war]
foo#eggs[.war]

Look here for more info:
http://tomcat.apache.org/tomcat-8.5-doc/config/context.html#Naming

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers.
Jäkel, Guido
2018-08-23 11:14:07 UTC
Permalink
Dear Chales (and James)

why do you call it not really a hierachy? If you name the deployments e.g.

ROOT.war
foo.war
foo#bar.war

then the "expected" will happen: The longest context path will match to the corresponding container:

* all /foo/bar{,/.*} will be served by foo#bar.war,
* all other /foo{,/.*} will be servered by foo.war
* all other {,.*} will be served by ROOT.war


@James: This will even work with Tomcat 6 ;)


Greetings

Guido
-----Original Message-----
Sent: Thursday, August 23, 2018 4:19 AM
Subject: RE: Contexts: can there be a hierarchy?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Caldarale, Charles R
2018-08-23 12:22:37 UTC
Permalink
Subject: RE: Contexts: can there be a hierarchy?
why do you call it not really a hierachy? If you name the deployments e.g.
ROOT.war
foo.war
foo#bar.war
then the "expected" will happen: The longest context path will match to
the
* all /foo/bar{,/.*} will be served by foo#bar.war,
* all other /foo{,/.*} will be servered by foo.war
* all other {,.*} will be served by ROOT.war
It's a hierarchy for the URLs, but not from a webapp location, construction,
or execution perspective - /foo/bar is completely independent of /foo, not
inside or a subset of it.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers.
Jäkel, Guido
2018-08-24 06:12:37 UTC
Permalink
Dear Chuck,
Post by Caldarale, Charles R
It's a hierarchy for the URLs, but not from a webapp location, construction,
or execution perspective - /foo/bar is completely independent of /foo, not
inside or a subset of it.
Reading that I understand what you have pointed out and of course fully agree to it :)

Greetings

Guido

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

James H. H. Lampert
2018-08-23 20:40:49 UTC
Permalink
Post by Caldarale, Charles R
Not really a hierarchy, but just name your .war files (or directories)
foo#ham[.war]
foo#eggs[.war]
http://tomcat.apache.org/tomcat-8.5-doc/config/context.html#Naming
Thanks. That answers my question.

The important thing is that it's a hierarchy from the URL construction
point of view (e.g., for purposes of path rules directing traffic to the
correct back-end of a load balancer). That it's not a hierarchy in the
file system is irrelevant.

--
JHHL

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