org.apache.myfaces.renderkit
Class ErrorPageWriter

java.lang.Object
  extended by org.apache.myfaces.renderkit.ErrorPageWriter

public final class ErrorPageWriter
extends java.lang.Object

This class provides utility methods to generate the MyFaces error and debug pages.

Author:
Jacob Hookom (ICLA with ASF filed), Jakob Korherr (refactored and moved here from javax.faces.webapp._ErrorPageWriter)

Nested Class Summary
static class ErrorPageWriter.ErrorPageBean
          This bean aims to generate the error page html for inclusion on a facelet error page via .
 
Field Summary
static java.lang.String DEBUG_INFO_KEY
          Extended debug info is stored under this key in the request map for every UIInput component when in Development mode.
static java.lang.String ERROR_HANDLING_PARAMETER
          Indicate if myfaces is responsible to handle errors.
static java.lang.String ERROR_PAGE_BEAN_KEY
          The key which is used to store the ErrorPageBean in the view map of a facelet error page.
 
Constructor Summary
ErrorPageWriter()
           
 
Method Summary
static void debugHtml(java.io.Writer writer, FacesContext faces)
          Generates the HTML debug page for the current view and writes it to the given writer.
static void debugHtml(java.io.Writer writer, FacesContext faces, java.lang.Throwable e)
          Generates the HTML error page for the given Throwable and writes it to the given writer.
static void handleThrowable(FacesContext facesContext, java.lang.Throwable ex)
          Handles the given Throwbale in the following way: If there is no entry in web.xml, try to reset the current HttpServletResponse, generate the error page and call responseComplete().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_PAGE_BEAN_KEY

public static final java.lang.String ERROR_PAGE_BEAN_KEY
The key which is used to store the ErrorPageBean in the view map of a facelet error page.

See Also:
Constant Field Values

DEBUG_INFO_KEY

public static final java.lang.String DEBUG_INFO_KEY
Extended debug info is stored under this key in the request map for every UIInput component when in Development mode. ATTENTION: this constant is duplicate in javax.faces.component.UIInput

See Also:
Constant Field Values

ERROR_HANDLING_PARAMETER

@JSFWebConfigParam(defaultValue="true",
                   expectedValues="true,false",
                   since="1.2.4")
public static final java.lang.String ERROR_HANDLING_PARAMETER
Indicate if myfaces is responsible to handle errors. See http://wiki.apache.org/myfaces/Handling_Server_Errors for details.

See Also:
Constant Field Values
Constructor Detail

ErrorPageWriter

public ErrorPageWriter()
Method Detail

debugHtml

public static void debugHtml(java.io.Writer writer,
                             FacesContext faces,
                             java.lang.Throwable e)
                      throws java.io.IOException
Generates the HTML error page for the given Throwable and writes it to the given writer.

Parameters:
writer -
faces -
e -
Throws:
java.io.IOException

debugHtml

public static void debugHtml(java.io.Writer writer,
                             FacesContext faces)
                      throws java.io.IOException
Generates the HTML debug page for the current view and writes it to the given writer.

Parameters:
writer -
faces -
Throws:
java.io.IOException

handleThrowable

public static void handleThrowable(FacesContext facesContext,
                                   java.lang.Throwable ex)
                            throws FacesException
Handles the given Throwbale in the following way: If there is no entry in web.xml, try to reset the current HttpServletResponse, generate the error page and call responseComplete(). If this fails, rethrow the Exception. If there is an entry in web.xml, save the current UIViewRoot in the RequestMap with the key "org.apache.myfaces.error.UIViewRoot" to access it on the error page and rethrow the Exception to let it flow up to FacesServlet.service() and thus be handled by the container.

Parameters:
facesContext -
ex -
Throws:
FacesException


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.