tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Tomcat mapping of URLs -> servlets
Date Wed, 03 Dec 2008 11:10:41 GMT
Markus Schönhaber wrote:
> André Warnier:
> 
>> 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.
> 
> Yep, for some reason unknown to me it's unnecessarily difficult to find
> the PDF with the 2.5 spec. Go here
> http://jcp.org/en/jsr/detail?id=154
> and select the topmost "Download page", i. e. the one for "Maintenance
> release 2" and you're just a few clicks away from downloading the PDF.
Thanks, that works.
Even when you get there though, it is still difficult to download this 
thing. The proposed filename is not a valid path and must be changed..

> 
> Starting on p. 87 the section "Mapping Requests to Servlets" will
> probably answer your questions.
> 
Kind of.
It appears anyway that my previous attempted logic was quite wrong.
But I still find the spec quite confusing.  There is some kind of 
mixture between "servlet" and "web application" that is not very clear, 
at least to me.

As I understand it now, there are 2 steps :
1) the appropriate webapp (not servlet) is located using the path, not 
the <url-pattern>
2) the appropriate servlet *within* the webapp is selected based on the 
<url-pattern>
and
3) .. each webapp has a "default servlet", to which things get mapped 
when no other <url-pattern> of this webapp matches
4) the ROOT webapp matches the path "/", not the <url-pattern> /

Is the above correct ?

The confusing part for me may also be due to my misunderstanding.
I view this as follows :
- a "web application" is "the whole thing" that one finds below 
(tomcat_dir)/webapps/xyz for example (including its static pages, 
WEB-INF/web.xml, its servlets etc..)
- this webapp can consist of one or more servlets, each with its set of 
<url-pattern>'s that it handles

Not so ?

And if so, then I find the examples in table "SRV.11.2.2 Example Mapping 
Set" quite confusing, since paths like
/foo
/bar
/catalog
would tend to imply different webapps, rather than different servlets 
inside of one webapp, no ?


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


Mime
View raw message