org.apache.myfaces.webapp.filter
Class WelcomeFileFilter
public
class
WelcomeFileFilter
extends 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.
Since: February 18th, 2003
Version: $Revision: 167257 $ $Date: 2004-10-13 13:51:02 +0200 (Wed, 13 Oct 2004) $
Author: Robert J. Lebowitz (latest modification by $Author: matze $) Anton Koinov
Method Summary |
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. |
public void destroy()
See Also: javax.servlet.Filter#destroy()
public 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.
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.
public void init(FilterConfig config)
During the init method, we have to get any predefined welcome files
for the current ServletContext.
Parameters: config The filter configuration data
Throws: ServletException