Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.facelets
Class FaceletViewHandler  view FaceletViewHandler download FaceletViewHandler.java

java.lang.Object
  extended byjavax.faces.application.ViewHandler
      extended bycom.sun.facelets.FaceletViewHandler
Direct Known Subclasses:
FaceletPortletViewHandler

public class FaceletViewHandler
extends javax.faces.application.ViewHandler

ViewHandler implementation for Facelets

Version:
$Id: FaceletViewHandler.java,v 1.49.2.6 2006/03/20 07:22:00 jhook Exp $

Nested Class Summary
protected static class FaceletViewHandler.NullWriter
           
 
Field Summary
private  int bufferSize
           
private  boolean buildBeforeRestore
           
static long DEFAULT_REFRESH_PERIOD
           
private  java.lang.String defaultSuffix
           
private  boolean developmentMode
           
private  java.lang.String[] extensionsArray
           
private  FaceletFactory faceletFactory
           
protected static java.util.logging.Logger log
           
static java.lang.String PARAM_BUFFER_SIZE
           
static java.lang.String PARAM_BUILD_BEFORE_RESTORE
           
static java.lang.String PARAM_DECORATORS
           
static java.lang.String PARAM_DEVELOPMENT
           
static java.lang.String PARAM_LIBRARIES
           
static java.lang.String PARAM_REFRESH_PERIO
           
static java.lang.String PARAM_RESOURCE_RESOLVER
           
static java.lang.String PARAM_SKIP_COMMENTS
           
static java.lang.String PARAM_VIEW_MAPPINGS
          Context initialization parameter for defining what viewIds should be handled by Facelets, and what should not.
private  javax.faces.application.ViewHandler parent
           
private  java.lang.String[] prefixesArray
           
private static java.lang.String STATE_KEY
           
private static int STATE_KEY_LEN
           
private static java.lang.Object STATE_NULL
           
 
Fields inherited from class javax.faces.application.ViewHandler
CHARACTER_ENCODING_KEY, DEFAULT_SUFFIX, DEFAULT_SUFFIX_PARAM_NAME
 
Constructor Summary
FaceletViewHandler(javax.faces.application.ViewHandler parent)
           
 
Method Summary
protected  void buildView(javax.faces.context.FacesContext context, javax.faces.component.UIViewRoot viewToRender)
           
 java.util.Locale calculateLocale(javax.faces.context.FacesContext context)
           
 java.lang.String calculateRenderKitId(javax.faces.context.FacesContext context)
           
protected  com.sun.facelets.compiler.Compiler createCompiler()
           
protected  FaceletFactory createFaceletFactory(com.sun.facelets.compiler.Compiler c)
           
protected  javax.faces.context.ResponseWriter createResponseWriter(javax.faces.context.FacesContext context)
           
 javax.faces.component.UIViewRoot createView(javax.faces.context.FacesContext context, java.lang.String viewId)
           
 java.lang.String getActionURL(javax.faces.context.FacesContext context, java.lang.String viewId)
           
 java.lang.String getDefaultSuffix(javax.faces.context.FacesContext context)
           
protected  java.lang.String getRenderedViewId(javax.faces.context.FacesContext context, java.lang.String actionId)
           
 java.lang.String getResourceURL(javax.faces.context.FacesContext context, java.lang.String path)
           
protected  java.lang.String getResponseContentType(javax.faces.context.FacesContext context, java.lang.String orig)
          Generate the content type
protected  java.lang.String getResponseEncoding(javax.faces.context.FacesContext context, java.lang.String orig)
          Generate the encoding
protected  javax.faces.application.ViewHandler getWrapped()
           
private  boolean handledByFacelets(java.lang.String viewId)
          Determine if Facelets needs to handle this request.
protected  void handleFaceletNotFound(javax.faces.context.FacesContext context, java.lang.String viewId)
           
protected  void handleRenderException(javax.faces.context.FacesContext context, java.lang.Exception e)
           
protected  void initialize(javax.faces.context.FacesContext context)
          Initialize the ViewHandler during its first request.
private  void initializeBuffer(javax.faces.context.FacesContext context)
           
protected  void initializeCompiler(com.sun.facelets.compiler.Compiler c)
           
private  void initializeMappings(javax.faces.context.FacesContext context)
          Initialize mappings, during the first request.
private  void initializeMode(javax.faces.context.FacesContext context)
           
private static boolean isPostback11(javax.faces.context.FacesContext context)
          Try to guess if this is a postback request.
 void renderView(javax.faces.context.FacesContext context, javax.faces.component.UIViewRoot viewToRender)
           
 javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context, java.lang.String viewId)
           
 void writeState(javax.faces.context.FacesContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final java.util.logging.Logger log

DEFAULT_REFRESH_PERIOD

public static final long DEFAULT_REFRESH_PERIOD
See Also:
Constant Field Values

PARAM_REFRESH_PERIO

public static final java.lang.String PARAM_REFRESH_PERIO
See Also:
Constant Field Values

PARAM_SKIP_COMMENTS

public static final java.lang.String PARAM_SKIP_COMMENTS
See Also:
Constant Field Values

PARAM_VIEW_MAPPINGS

public static final java.lang.String PARAM_VIEW_MAPPINGS
Context initialization parameter for defining what viewIds should be handled by Facelets, and what should not. When left unset, all URLs will be handled by Facelets. When set, it must be a semicolon separated list of either extension mappings or prefix mappings. For example:
    
     
      
        <context-param>
          <param-name>facelets.VIEW_MAPPINGS</param-name>
          <param-value>/demos/*; *.xhtml</param-value>
        </context-param>
       
      
     
 
would use Facelets for processing all viewIds in the "/demos" directory or that end in .xhtml, and use the standard JSP engine for all other viewIds.

NOTE: when using this parameter, you need to use prefix-mapping for the FacesServlet (that is, /faces/*, not *.jsf).

See Also:
Constant Field Values

PARAM_LIBRARIES

public static final java.lang.String PARAM_LIBRARIES
See Also:
Constant Field Values

PARAM_DECORATORS

public static final java.lang.String PARAM_DECORATORS
See Also:
Constant Field Values

PARAM_DEVELOPMENT

public static final java.lang.String PARAM_DEVELOPMENT
See Also:
Constant Field Values

PARAM_RESOURCE_RESOLVER

public static final java.lang.String PARAM_RESOURCE_RESOLVER
See Also:
Constant Field Values

PARAM_BUILD_BEFORE_RESTORE

public static final java.lang.String PARAM_BUILD_BEFORE_RESTORE
See Also:
Constant Field Values

PARAM_BUFFER_SIZE

public static final java.lang.String PARAM_BUFFER_SIZE
See Also:
Constant Field Values

STATE_KEY

private static final java.lang.String STATE_KEY
See Also:
Constant Field Values

STATE_KEY_LEN

private static final int STATE_KEY_LEN

STATE_NULL

private static final java.lang.Object STATE_NULL

parent

private final javax.faces.application.ViewHandler parent

developmentMode

private boolean developmentMode

buildBeforeRestore

private boolean buildBeforeRestore

bufferSize

private int bufferSize

defaultSuffix

private java.lang.String defaultSuffix

faceletFactory

private FaceletFactory faceletFactory

extensionsArray

private java.lang.String[] extensionsArray

prefixesArray

private java.lang.String[] prefixesArray
Constructor Detail

FaceletViewHandler

public FaceletViewHandler(javax.faces.application.ViewHandler parent)
Method Detail

initialize

protected void initialize(javax.faces.context.FacesContext context)
Initialize the ViewHandler during its first request.


initializeMode

private void initializeMode(javax.faces.context.FacesContext context)

initializeBuffer

private void initializeBuffer(javax.faces.context.FacesContext context)

initializeMappings

private void initializeMappings(javax.faces.context.FacesContext context)
Initialize mappings, during the first request.


createFaceletFactory

protected FaceletFactory createFaceletFactory(com.sun.facelets.compiler.Compiler c)

createCompiler

protected com.sun.facelets.compiler.Compiler createCompiler()

initializeCompiler

protected void initializeCompiler(com.sun.facelets.compiler.Compiler c)

restoreView

public javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context,
                                                    java.lang.String viewId)

getWrapped

protected javax.faces.application.ViewHandler getWrapped()

createResponseWriter

protected javax.faces.context.ResponseWriter createResponseWriter(javax.faces.context.FacesContext context)
                                                           throws java.io.IOException,
                                                                  javax.faces.FacesException

getResponseEncoding

protected java.lang.String getResponseEncoding(javax.faces.context.FacesContext context,
                                               java.lang.String orig)
Generate the encoding


getResponseContentType

protected java.lang.String getResponseContentType(javax.faces.context.FacesContext context,
                                                  java.lang.String orig)
Generate the content type


buildView

protected void buildView(javax.faces.context.FacesContext context,
                         javax.faces.component.UIViewRoot viewToRender)
                  throws java.io.IOException,
                         javax.faces.FacesException

renderView

public void renderView(javax.faces.context.FacesContext context,
                       javax.faces.component.UIViewRoot viewToRender)
                throws java.io.IOException,
                       javax.faces.FacesException

handleRenderException

protected void handleRenderException(javax.faces.context.FacesContext context,
                                     java.lang.Exception e)
                              throws java.io.IOException,
                                     ELException,
                                     javax.faces.FacesException

handleFaceletNotFound

protected void handleFaceletNotFound(javax.faces.context.FacesContext context,
                                     java.lang.String viewId)
                              throws javax.faces.FacesException,
                                     java.io.IOException

handledByFacelets

private boolean handledByFacelets(java.lang.String viewId)
Determine if Facelets needs to handle this request.


getDefaultSuffix

public java.lang.String getDefaultSuffix(javax.faces.context.FacesContext context)
                                  throws javax.faces.FacesException

getRenderedViewId

protected java.lang.String getRenderedViewId(javax.faces.context.FacesContext context,
                                             java.lang.String actionId)

writeState

public void writeState(javax.faces.context.FacesContext context)
                throws java.io.IOException

calculateLocale

public java.util.Locale calculateLocale(javax.faces.context.FacesContext context)

calculateRenderKitId

public java.lang.String calculateRenderKitId(javax.faces.context.FacesContext context)

createView

public javax.faces.component.UIViewRoot createView(javax.faces.context.FacesContext context,
                                                   java.lang.String viewId)

getActionURL

public java.lang.String getActionURL(javax.faces.context.FacesContext context,
                                     java.lang.String viewId)

getResourceURL

public java.lang.String getResourceURL(javax.faces.context.FacesContext context,
                                       java.lang.String path)

isPostback11

private static boolean isPostback11(javax.faces.context.FacesContext context)
Try to guess if this is a postback request. In JSF 1.2, this method is not needed, since ResponseStateManager can identify postbacks. We use a simple heuristic: for HttpServletRequests, "POST" and "PUT" are postbacks. For anything that isn't an HttpServletRequest, just guess that if there's a request parameter, it's probably a postback.