Hi.
This is a beginner-like question.
I have tried to download and find this in the Servlet 2.5 Specification,
but I seem to get a series of html pages describing the API, without
telling me much about the general principles.
So just in case this is not nicely explained in English in the spec :
How does a servlet container like Tomcat map a request URI to any
particular webapp ?
I mean, suppose we have 3 webapps with each a <servlet-mapping> section,
in which each time there are several <url-pattern> tags.
I am not talking here about the strict interpretation of these
<url-pattern> tags (although there is a question about why the servlet
spec designers in their wisdom thought that they needed to invent yet
another wildcard scheme).
But rather, about how Tomcat takes all these <servlet-mapping> sections
of all the servlets, and then decides, when a request comes in, to which
of the servlets it attributes the request.
Does it work as follows ?
When the various webapps are loaded (started ?), Tomcat collects all the
<url-pattern>'s of all the webapps.
It then sorts them by length (longest first), independently of the
webapp from whence they come.
When a request comes in, Tomcat compares the request URI with the first
URL-pattern. If it matches, Tomcat delegates the request to the
corresponding webapp.
If not, it checks the next pattern in the table, etc..
If the request URI does not match any url-pattern, Tomcat delegates the
request to the "default webapp".
As a corollary to the above : whenever a webapp is stopped (unloaded?)
or a new webapp is started (loaded ?), Tomcat for a while stops
processing new requests and rebuilds this entire sorted url-pattern
matching table.
As another corollary : the webapp called ROOT always has a url-pattern
of "/", which because it is the shortest is always at the end of the
table, and thus matches anything that does not match something else ?
Then, assuming the above is generaly correct, there is a remaining
question about the interpretation of "length" in terms of a url-pattern.
Such as, how is the length compared between patterns like "/myservlet*"
and "*.myservlet" ?
Thanks for some light in the matter.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]