Hello, I've read the servlet spec chapters relevant to this problem, and searched the mailing list. I think I might have exposed a certain condition where the welcome-file functionality isn't working correctly. JDK: 1.4.2 Linux: 2.6.1 Tomcat: 5.0.18 Struts: 1.1 Here is my web.xml sections I believe are relevant: ---------------------------- <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>2</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.x</url-pattern> </servlet-mapping> ... cut ... <welcome-file-list> <welcome-file>index.x</welcome-file> </welcome-file-list> ---------------------------- When I go to: http://localhost:8080/appContext/ I see an empty directory listing. (this is because all my jsp files are in WEB-INF) When I go to: http://localhost:8080/appContext/index.x I see the correct page. I believe, according to servlet 2.4, I should be able to place a mapping to a servlet in the welcome-file. I can't see any error in catalina.out or the localhost-DATE.log file. I have no other servlets declared, and no default servlet declared. Any ideas or tips? Thanks very much, Seth
This is like a really ugly use-case, but I have to agree with your reading of the 2.4 servlet-spec in this case.
I have to disagree: welcome files cannot possibly apply to extension mapping. This was already discussed with Jean François a while ago.
I have one small example to add: if this bug was valid, using the spec mandated default welcome files and servlet mappings, we would always redirect to index.jsp.
OK, not sure why welcome files can't apply to extension mappings. More importantly, does the spec say that? If it is implied, it should be explicitly stated. Reading the spec (at least, my interpretation) does not imply that extension mappings and welcome files can't play together. Is this a tomcat limitation or a spec limitation? Thanks!
Look at my example. Does that behavior makes sense ? No. So you have your answer :)
I have faced the same problem. I have: ... <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> ... <welcome-file-list> <welcome-file>Welcome.do</welcome-file> </welcome-file-list> when I try: http://host:port/ I get 404. if I try http://host:port/Welcome.do works fine. Servlet 2.4 specs says (on pdf version page 76): "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 the WAR is mapped to that request URI." I think its pretty clear that servlet mapping should be applied to welcome-file elements. Also, if I change my dd to: ... <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>/Welcome.do</url-pattern> </servlet-mapping> ... <welcome-file-list> <welcome-file>Welcome.do</welcome-file> </welcome-file-list> Everything works fine (so in this case, Tomcat is performing servlet mapping). It's definitely a bug.
Wow, I am so impressed by your arguments (cut & pasted from the comments right above I'm sure) ;) If it wouldn't create a non working container, I would gladly fix this "bug". Thanks for not reopening the report, BTW.
Remy Maucherat, I wonder how someone can get so arrogant. Your attitude is just not helping. It's pretty clear that I didn't copy&paste. As you can see, I checked the specs, and also found a work-around (which might be helpful for other people). It would be nice if you could share a little bit of your acknowledge in this matter with us, mere mortals. Of course it would also give credibility to your statements, so other people won't ask again. In short: Why can't it be implemented?
Can you answer these two questions ? - how is your example different from the one given on top of the page ? - what do you think will happen, given the default configuration for all webapps is to have index.jsp as (one of) the welcome files, with a default mapping of *.jsp to the JSP processing servlet ? (I did point that out a few comments above, but you don't seem to bother reading; whining is so easy ...)
Well, it's interesting to see how this "invalid" bug report and the equivalent bug #37424, classified as "nonsense" by Remy, was actually fixed in Tomcat 7 as bug #47378 ;-)