You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Berche, Guillaume" <Gu...@mkms.xerox.com> on 2001/02/27 09:52:26 UTC
Bug report: welcome-file broken with non static pages (e.g. servl
et paths)
Hello,
Despites the Servlet specs 2.2 are pretty vague about this problem, I guess that the <welcome-file> entry should be able to specify servlet names. However, tomcat 3.2.1 fails to do this. Looking a bit into it, I diagnosed it as follows:
org.apache.tomcat.request.StaticInterceptor.getWelcomeFile(Context context, File dir) checks for each welcome-file entry to verify it corresponds to a physically available file. Then, if the file if found, an HTTP redirection would be sent. Consequently, if the welcome-file entry is a servlet path (specified with a servlet mapping) then it would fail.
I worked around the problem in my local copy of tomcat 3.2.1 by removing the checking of the availability of the file and thus always redirecting to the first welcome-file entry. If this can help someone, here is the patched code in org.apache.tomcat.request.StaticInterceptor.getWelcomeFile(Context context, File dir)
I hope this can help,
Guillaume.
<!--
The welcome-file-list contains an ordered list of welcome files
elements.
-->
<!ELEMENT welcome-file-list (welcome-file+)>
<!--
The welcome-file element contains file name to use as a default
welcome file, such as index.html
-->
<!ELEMENT welcome-file (#PCDATA)>
private String getWelcomeFile(Context context, File dir) {
Enumeration enum = context.getWelcomeFiles();
while (enum.hasMoreElements()) {
String fileName = (String)enum.nextElement();
File f = new File(dir, fileName);
//GBE patch: always return the first welcome-file even if we can't
//check that it exists: it might be a JSP page which would require
//another interceptor to come into the play to handle it if
//(f.exists()) {
return fileName;
// }
}
return null;
}
Re: Bug report: welcome-file broken with non static pages (e.g. servlet
paths)
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"Berche, Guillaume" wrote:
> Hello,
>
> Despites the Servlet specs 2.2 are pretty vague about this problem, I guess that the <welcome-file> entry should be able to specify servlet names. However, tomcat 3.2.1 fails to do this. Looking a bit into it, I diagnosed it as follows:
>
FYI, this is going to be one of the many clarifications in 2.3 -- containers will be required to support servlet URIs as "welcome files".
Craig McCLanahan