You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "James H. H. Lampert" <ja...@touchtonecorp.com> on 2018/08/23 00:35:30 UTC

Contexts: can there be a hierarchy?

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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Contexts: can there be a hierarchy?

Posted by "James H. H. Lampert" <ja...@touchtonecorp.com>.
On 8/22/18, 7:18 PM, Caldarale, Charles R wrote:
> 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

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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Contexts: can there be a hierarchy?

Posted by Jäkel, Guido <G....@dnb.de>.
Dear Chuck,

>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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Contexts: can there be a hierarchy?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jäkel, Guido [mailto:G.Jaekel@dnb.de] 
> 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 
> 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

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.


RE: Contexts: can there be a hierarchy?

Posted by Jäkel, Guido <G....@dnb.de>.
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-----
>From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
>Sent: Thursday, August 23, 2018 4:19 AM
>To: Tomcat Users List <us...@tomcat.apache.org>
>Subject: RE: Contexts: can there be a hierarchy?
>
>Not really a hierarchy, but just name your .war files (or directories) appropriately:

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


RE: Contexts: can there be a hierarchy?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: James H. H. Lampert [mailto:jamesl@touchtonecorp.com] 
> 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.