Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.myfaces.webapp.filter
Class WelcomeFileFilter

    java.lang.Object
      org.apache.myfaces.webapp.filter.WelcomeFileFilter

All Implemented Interfaces:
  javax.servlet.Filter

public class WelcomeFileFilter
extends java.lang.Object
implements javax.servlet.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 07:51:02 -0400 (Wed, 13 Oct 2004) $
Author:
  Robert J. Lebowitz (latest modification by $Author: matze $), Anton Koinov

Constructor Summary
`WelcomeFileFilter()`

Method Summary
`void` | `destroy()`
`void` | `doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.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(javax.servlet.FilterConfig config)` During the init method, we have to get any predefined welcome files for the current ServletContext.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WelcomeFileFilter

    public WelcomeFileFilter()

Method Detail

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `javax.servlet.Filter`
  See Also:
    `Filter.destroy()`

### doFilter

    public void doFilter(javax.servlet.ServletRequest request,
                         javax.servlet.ServletResponse response,
                         javax.servlet.FilterChain chain)
                  throws java.io.IOException,
                         javax.servlet.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.

  Specified by:
    `doFilter` in interface `javax.servlet.Filter`
  Throws:
    `java.io.IOException`
    `javax.servlet.ServletException`

### init

    public void init(javax.servlet.FilterConfig config)
              throws javax.servlet.ServletException

  During the init method, we have to get any predefined welcome files for the current ServletContext.

  Specified by:
    `init` in interface `javax.servlet.Filter`
  Parameters:
    `config` - The filter configuration data
  Throws:
    `javax.servlet.ServletException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD