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

## javax.faces.webapp
Class FacesServlet

    java.lang.Object
      javax.faces.webapp.FacesServlet

All Implemented Interfaces:
  javax.servlet.Servlet

    public final class FacesServlet

extends Object
implements javax.servlet.Servlet

FacesServlet is a servlet that manages the request processing lifecycle for web applications that are utilizing JavaServer Faces to construct the user interface.

Field Summary
`static String` | `CONFIG_FILES_ATTR` Context initialization parameter name for a comma delimited list of context-relative resource paths (in addition to `/WEB-INF/faces-config.xml` which is loaded automatically if it exists) containing JavaServer Faces configuration information.
`static String` | `LIFECYCLE_ID_ATTR` Context initialization parameter name for the lifecycle identifier of the `Lifecycle` instance to be utilized.

Constructor Summary
`FacesServlet()`

Method Summary
`void` | `destroy()` Release all resources acquired at startup time.
`javax.servlet.ServletConfig` | `getServletConfig()` Return the `ServletConfig` instance for this servlet.
`String` | `getServletInfo()` Return information about this Servlet.
`void` | `init(javax.servlet.ServletConfig servletConfig)` Acquire the factory instances we will require.
`void` | `service(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)` Process an incoming request, and create the corresponding response according to the following specification.

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

Field Detail

### CONFIG_FILES_ATTR

    public static final String CONFIG_FILES_ATTR

  Context initialization parameter name for a comma delimited list of context-relative resource paths (in addition to `/WEB-INF/faces-config.xml` which is loaded automatically if it exists) containing JavaServer Faces configuration information.

  See Also:
    Constant Field Values

### LIFECYCLE_ID_ATTR

    public static final String LIFECYCLE_ID_ATTR

  Context initialization parameter name for the lifecycle identifier of the `Lifecycle` instance to be utilized.

  See Also:
    Constant Field Values

Constructor Detail

### FacesServlet

    public FacesServlet()

Method Detail

### destroy

    public void destroy()

  Release all resources acquired at startup time.

  Specified by:
    `destroy` in interface `javax.servlet.Servlet`

### getServletConfig

    public javax.servlet.ServletConfig getServletConfig()

  Return the `ServletConfig` instance for this servlet.

  Specified by:
    `getServletConfig` in interface `javax.servlet.Servlet`

### getServletInfo

    public String getServletInfo()

  Return information about this Servlet.

  Specified by:
    `getServletInfo` in interface `javax.servlet.Servlet`

### init

    public void init(javax.servlet.ServletConfig servletConfig)
              throws javax.servlet.ServletException

  Acquire the factory instances we will require.

  Specified by:
    `init` in interface `javax.servlet.Servlet`
  Throws:
    `javax.servlet.ServletException` - if, for any reason, the startup of this Faces application failed. This includes errors in the config file that is parsed before or during the processing of this `init()` method.

### service

    public void service(javax.servlet.ServletRequest request,
                        javax.servlet.ServletResponse response)
                 throws IOException,
                        javax.servlet.ServletException

  Process an incoming request, and create the corresponding response according to the following specification.

  If the `request` and `response` arguments to this method are not instances of `HttpServletRequest` and `HttpServletResponse`, respectively, the results of invoking this method are undefined.

  This method must respond to requests that start with the following strings by invoking the `sendError` method on the response argument (cast to `HttpServletResponse`), passing the code `HttpServletResponse.SC_NOT_FOUND` as the argument.

      /WEB-INF/
      /WEB-INF
      /META-INF/
      /META-INF

  If none of the cases described above in the specification for this method apply to the servicing of this request, the following action must be taken to service the request.

  Acquire a `FacesContext` instance for this request.

  Acquire the `ResourceHandler` for this request by calling `Application.getResourceHandler()`. Call `ResourceHandler.isResourceRequest(javax.faces.context.FacesContext)`. If this returns `true` call `ResourceHandler.handleResourceRequest(javax.faces.context.FacesContext)`. If this returns `false`, call `Lifecycle.execute(javax.faces.context.FacesContext)` followed by `Lifecycle.render(javax.faces.context.FacesContext)`. If a `FacesException` is thrown in either case, extract the cause from the `FacesException`. If the cause is `null` extract the message from the `FacesException`, put it inside of a new `ServletException` instance, and pass the `FacesException` instance as the root cause, then rethrow the `ServletException` instance. If the cause is an instance of `ServletException`, rethrow the cause. If the cause is an instance of `IOException`, rethrow the cause. Otherwise, create a new `ServletException` instance, passing the message from the cause, as the first argument, and the cause itself as the second argument.

  In a finally block, `FacesContext.release()` must be called.

  Specified by:
    `service` in interface `javax.servlet.Servlet`
  Parameters:
    `request` - The servlet request we are processing
    `response` - The servlet response we are creating
  Throws:
    `IOException` - if an input/output error occurs during processing
    `javax.servlet.ServletException` - if a servlet error occurs during processing

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

Copyright © 2002-2009 Sun Microsystems, Inc. All Rights Reserved.