org.apache.myfaces.webapp.filter
Class WelcomeFileFilter
java.lang.Object
org.apache.myfaces.webapp.filter.WelcomeFileFilter
- Filter
public class WelcomeFileFilter
extends java.lang.Object
implements Filter
Due to the manner in which the JSP / servlet lifecycle
functions, it is not currently possible to specify default
welcome files for a web application and map them to the
MyFacesServlet. Normally they will be mapped to the
default servlet for the JSP container. To offset this
shortcoming, we utilize a servlet Filter which examines
the URI of all incoming requests.
$Revision: 167257 $ $Date: 2004-10-13 13:51:02 +0200 (Wed, 13 Oct 2004) $- Robert J. Lebowitz (latest modification by $Author: matze $)
- Anton Koinov
void | destroy()
|
void | doFilter(ServletRequest request, ServletResponse response, FilterChain chain) -
If the URI indicates a context, or a subdirectory within a particular
context, but does not specify a filename, the request is redirected to
one of the default welcome files, assuming they are provided in the web.xml file.
|
void | init(FilterConfig config) - During the init method, we have to get any predefined welcome files
for the current ServletContext.
|
destroy
public void destroy()
javax.servlet.Filter.destroy()
doFilter
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
throws IOException,
ServletException
If the URI indicates a context, or a subdirectory within a particular
context, but does not specify a filename, the request is redirected to
one of the default welcome files, assuming they are provided in the web.xml file.
If no welcome files are specified, or if none of the welcome files
actually exists, then the request is redirected to a file named "index.jsp" for
that context or subdirectory with the current context. If the index.jsp file
does not exist, the servlet will return a File Not Found Error 404 message.
A well configured servlet should provide a means of handling this type of
error, along with a link to an appropriate help page.
A URI is thought to represent a context and/or subdirectory(s) if
it lacks a suffix following the pattern .suffix.
init
public void init(FilterConfig config)
throws ServletException
During the init method, we have to get any predefined welcome files
for the current ServletContext.
config
- The filter configuration data