Save This Page
Home » tomahawk-1.1.6-src » org.apache.myfaces.webapp » filter » [javadoc | source]
org.apache.myfaces.webapp.filter
public class: WelcomeFileFilter [javadoc | source]
java.lang.Object
   org.apache.myfaces.webapp.filter.WelcomeFileFilter

All Implemented Interfaces:
    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.
Method from org.apache.myfaces.webapp.filter.WelcomeFileFilter Summary:
destroy,   doFilter,   init
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.myfaces.webapp.filter.WelcomeFileFilter Detail:
 public  void destroy() 
 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.
 public  void init(FilterConfig config) throws ServletException 
    During the init method, we have to get any predefined welcome files for the current ServletContext.