tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marten Lehmann <lehm...@cnm.de>
Subject Re: how to set index.faces as welcome-file
Date Wed, 27 Jul 2005 14:29:57 GMT
Hello,

thanks for your class. I'm not usig it (and I guess its partially wrong, 
because you can't simply append the welcome-file the the path-info), but 
it inspired me to create a better way: Through a filter. I attached the 
filter-class, you would integrate it in the web.xml as follows:

     <filter>
         <filter-name>FakeIndexFilter</filter-name>
         <filter-class>web.filter.FakeIndexFilter</filter-class>
     </filter>
     <filter-mapping>
         <filter-name>FakeIndexFilter</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>

I didn't put a GPL-notice in there, but I guess it's useful for everyone 
and maybe it can be included in the Tomcat distribution as well.

The way it works is pretty simple: If the servletpath doesn't end with 
"/", the request is just passed to the next filter. If it does end with 
"/", it will be checked if the file index.jsp exists, because every 
.faces-file will be mapped to the according .jsp-file. If the .jsp-file 
exists, a forward to servletpath+index.faces will be done. Otherwise, 
the request is passed to the next filter, where you would possibly get 
the directory listing in the end.

Regards
Marten

Mime
View raw message