Rene Scheffler wrote:
Hey guys,

i just added "some" entries to the default web.xml and server.xml.
[...]
I do not have a lot of time today, so I'll let someone else pick apart what you did, and maybe try to figure out why what you did created WEB-INF directories all over the place.

But there are a few general principles in Tomcat, which are not always very explicit in the standard documentation (*), but which are quite important nevertheless, to understand how it works.

(*) they are there if you know where to look, but it takes a while before you get to that point.

1) whatever you put in server.xml is really "top-level" with Tomcat. That file is read only when Tomcat starts, so whatever you put in there is static, and cannot be undone later (unless you reboot Tomcat). So the general idea is : you should only put there what really needs to be there, and not more. For example, Host's need to be there, but anything to do with web applications (or "webapps" or "contexts") is better defined somewhere else.

2) Similarly, the generic conf/web.xml applies to *all* web applications running under your Tomcat. (it is merged with the individual web.xml's of each web application, before these applications are started). So there also, you should use caution when modifying it, because whatever you change will probably have far-reaching side-effects.
And of course also because to undo what's in there, you need to restart the 
whole Tomcat.

3) when Tomcat starts, it scans its /webapps directory, and takes note of any sub-directory that it finds there (and also any WAR file, but let's leave this for later). In the absence of any further instructions, each of these sub-directory names becomes the name of a webapp, and that is later used by Tomcat to "map" a URL received by Tomcat, to one of these webapps. So for example is a client sends a request for "http://yourhost/name1/*";, Tomcat is going to look for a webapp named "name1", and if it finds it, it will pass the request to that webapp for processing. And if Tomcat does not find a webapp named "name1", then it will pass the request to its "default webapp", the one named "ROOT" (located in /webapps/ROOT/).

4) Once Tomcat has delegated the processing of a request to a specific webapp, another level of mapping takes place inside of that webapp, using the rest of the request URL (the part after "http://hostname/name1/...";.
That's where the "url-mapping" elements, in the WEB-INF/web.xml of that webapp, 
enter in play.
If Tomcat finds a mapping that matches one of the webapp's servlets, then that servlet will be called to process the request. If no specific mapping is found, then Tomcat will pass the request to the "default servlet" of that webapp (which is built-in in Tomcat, and automatically added to each webapp). (That is the servlet which just returns a static document from the filesystem).

So, I don't know CFML at all, and I don't know if this is the kind of application which wants to take over your whole Tomcat, and not leave anything to decide by any other webapp. But if it is not your intention to let CFML take over you whole Tomcat, then you should not make those changes in the general web.xml, but make them in the WEB-INF/web.xml *of your CFML webapp*, and not at any higher level.

And similarly, if there are things that need to be specified in the <Context> of your webapp, these things should normally go in ../webapps/yourwebapp/META-INF/context.xml, and not in the general server.xml.

And maybe read the page :
https://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html
(although it is not for the faint of heart)
and particularly the section "A word on Contexts".


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

Reply via email to