Accordinlgy to HFSJ page 593, the following sequence is used to "find" the client's requested URL:
1) Container looks in the DD for a servlet mapping. 2) If a mapping cannot be found, the Container looks in the welcome-file-list, and starting from the first entry it founds, it tries to locate the specified welcome file within the directory received in the request.
In your case, the url doesn't match the servlet-mapping, and then there is no welcome.wc file in those directories. [ March 27, 2007: Message edited by: Sergio Tridente ]
If a Web container receives a valid partial request, the Web container must examine the welcome file list defined in the deployment descriptor. The welcome file list is an ordered list of partial URLs with no trailing or leading /. The Web server must append each welcome file in the order specified in the deployment descriptor to the partial request and check whether a static resource or servlet in theWAR is mapped to that request URI. TheWeb container must send the request to the first resource in the WAR that matches. The container may send the request to the welcome resource with a forward, a redirect, or a container specific mechanism that is indistinguishable from a direct request.
The only thing I can think of is when you request /test/xxx/ the container appends the welcome.wc from the welcome-file-list and first searches for a static resource with the name "welcome.wc" in the /test/xxx/ directory. If that does not exist (in this case) it looks for a servlet which is (statically?!) mapped to /test/xxx/welcome.wc, which in this case there is none... A lousy answer I know, but the *.wc url-pattern-welcome-file-list mapping simply does not seem to work. Anybody else have a good explanation?
Johan Pelgrim, The Netherlands
SCJP 1.4, SCWCD 1.4, SCBCD 5.0
It seems that your web.xml is OK and the problem you are experiencing is due to a bug in (our version of) Tomcat. I found this link in Sun's developers network forum that explains how to workaround the bug. I just did what they suggest and it worked with your original web.xml.