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;
    }


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to