Package org.apache.myfaces.view.facelets
Class FaceletViewDeclarationLanguage
java.lang.Object
jakarta.faces.view.ViewDeclarationLanguage
org.apache.myfaces.view.ViewDeclarationLanguageBase
org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguageBase
org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage
This class represents the abstraction of Facelets as a ViewDeclarationLanguage.
- Since:
- 2.0
- Version:
- $Revision$ $Date$
- Author:
- Simon Lessard (latest modification by $Author$)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
Key used to cache component ids for the counterstatic final String
static final String
static final String
static final String
static final String
static final String
Marker to indicate tag handlers the view currently being built is using partial state saving and it is necessary to call UIComponent.markInitialState after component instances are populated.static final String
Constant used by EncodingHandler to indicate the current encoding of the page being built, and indicate which one is the response encoding on getResponseEncoding(FacesContext, String) method.static final String
static final String
static final String
static final String
Fields inherited from class jakarta.faces.view.ViewDeclarationLanguage
FACELETS_VIEW_DECLARATION_LANGUAGE_ID
-
Constructor Summary
ConstructorsConstructorDescriptionFaceletViewDeclarationLanguage
(FacesContext context, ViewDeclarationLanguageStrategy strategy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildView
(FacesContext context, UIViewRoot view) calculateResourceLibraryContracts
(FacesContext context, String viewId) protected String
calculateViewId
(FacesContext context, String viewId) Calculates the effective view identifier for the specified raw view identifier.static void
cleanTransientBuildOnRestore
(FacesContext context) protected Compiler
createCompiler
(FacesContext context) Creates the Facelet page compiler.createComponent
(FacesContext context, String taglibURI, String tagName, Map<String, Object> attributes) protected FaceletFactory
createFaceletFactory
(FacesContext context, Compiler compiler) Creates a FaceletFactory instance using the specified compiler.protected ResponseWriter
createResponseWriter
(FacesContext context) createView
(FacesContext context, String viewId) Process the specification required algorithm that is generic to all PDL.getComponentMetadata
(FacesContext context, Resource componentResource) retargetMethodExpressions(FacesContext, UIComponent) has some clues about the behavior of this methodgetId()
protected String
getResponseContentType
(FacesContext context, String orig) Generate the content typeprotected String
getResponseEncoding
(FacesContext context, String orig) Generate the encodinggetScriptComponentResource
(FacesContext context, Resource componentResource) getStateManagementStrategy
(FacesContext context, String viewId) getViewMetadata
(FacesContext context, String viewId) getViews
(FacesContext facesContext, String path, int maxDepth, ViewVisitOption... options) protected void
handleFaceletNotFound
(FacesContext context, String viewId) protected void
handleRenderException
(FacesContext context, Exception e) static boolean
isBuildingViewMetadata
(FacesContext context) Check if the current facelet applied is used to build view metadata.static boolean
static boolean
isMarkInitialState
(FacesContext context) static boolean
isRefreshingTransientBuild
(FacesContext context) static boolean
isRefreshTransientBuildOnPSS
(FacesContext context) static boolean
static boolean
isRemovingComponentBuild
(FacesContext context) static boolean
isUsingPSSOnThisView
(FacesContext context) protected void
loadDecorators
(FacesContext context, Compiler compiler) Load the various decorators for Facelets.protected void
loadLibraries
(FacesContext context, Compiler compiler) Load the various tag libraries for Facelets.protected void
loadOptions
(FacesContext context, Compiler compiler) Load the various options for Facelets compiler.void
renderView
(FacesContext context, UIViewRoot view) restoreView
(FacesContext context, String viewId) void
retargetAttachedObjects
(FacesContext context, UIComponent topLevelComponent, List<AttachedObjectHandler> handlerList) In short words, this method take care of "target" an "attached object".void
retargetMethodExpressions
(FacesContext context, UIComponent topLevelComponent) protected void
sendSourceNotFound
(FacesContext context, String message) Send a source not found to the client.boolean
viewExists
(FacesContext context, String viewId) Methods inherited from class org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguageBase
activateDynamicComponentRefreshTransientBuild, dynamicComponentNeedsRefresh, getRenderKitFactory, getVisitContextFactory, isDynamicComponentNeedsRefresh, isDynamicComponentRefreshTransientBuildActive, isDynamicComponentRefreshTransientBuildActive, resetDynamicComponentNeedsRefreshFlag
Methods inherited from class jakarta.faces.view.ViewDeclarationLanguage
getViews
-
Field Details
-
DEFAULT_CHARACTER_ENCODING
- See Also:
-
PARAM_ENCODING
Constant used by EncodingHandler to indicate the current encoding of the page being built, and indicate which one is the response encoding on getResponseEncoding(FacesContext, String) method.- See Also:
-
BUILDING_VIEW_METADATA
- See Also:
-
REFRESHING_TRANSIENT_BUILD
- See Also:
-
REFRESH_TRANSIENT_BUILD_ON_PSS
- See Also:
-
USING_PSS_ON_THIS_VIEW
- See Also:
-
REMOVING_COMPONENTS_BUILD
- See Also:
-
DYN_WRAPPER
- See Also:
-
GEN_MARK_ID
- See Also:
-
MARK_INITIAL_STATE_KEY
Marker to indicate tag handlers the view currently being built is using partial state saving and it is necessary to call UIComponent.markInitialState after component instances are populated.- See Also:
-
IS_BUILDING_INITIAL_STATE_KEY_ALIAS
- See Also:
-
CLEAN_TRANSIENT_BUILD_ON_RESTORE
- See Also:
-
CACHED_COMPONENT_IDS
Key used to cache component ids for the counter- See Also:
-
-
Constructor Details
-
FaceletViewDeclarationLanguage
-
FaceletViewDeclarationLanguage
public FaceletViewDeclarationLanguage(FacesContext context, ViewDeclarationLanguageStrategy strategy)
-
-
Method Details
-
getId
- Overrides:
getId
in classViewDeclarationLanguage
-
viewExists
- Overrides:
viewExists
in classViewDeclarationLanguage
-
buildView
- Specified by:
buildView
in classViewDeclarationLanguage
- Throws:
IOException
-
getComponentMetadata
retargetMethodExpressions(FacesContext, UIComponent) has some clues about the behavior of this method- Specified by:
getComponentMetadata
in classViewDeclarationLanguage
-
isBuildingViewMetadata
Check if the current facelet applied is used to build view metadata.- Parameters:
context
-- Returns:
-
isRefreshingTransientBuild
-
isRemovingComponentBuild
-
isMarkInitialState
-
isRefreshTransientBuildOnPSS
-
isRefreshTransientBuildOnPSSAuto
-
isCleanTransientBuildOnRestore
-
cleanTransientBuildOnRestore
-
isUsingPSSOnThisView
-
retargetAttachedObjects
public void retargetAttachedObjects(FacesContext context, UIComponent topLevelComponent, List<AttachedObjectHandler> handlerList) In short words, this method take care of "target" an "attached object".- The "attached object" is instantiated by a tag handler.
- The "target" is an object used as "marker", that exposes a List<UIComponent>
- Overrides:
retargetAttachedObjects
in classViewDeclarationLanguage
-
retargetMethodExpressions
- Overrides:
retargetMethodExpressions
in classViewDeclarationLanguage
-
getScriptComponentResource
- Specified by:
getScriptComponentResource
in classViewDeclarationLanguage
-
getStateManagementStrategy
- Specified by:
getStateManagementStrategy
in classViewDeclarationLanguage
-
getViewMetadata
- Specified by:
getViewMetadata
in classViewDeclarationLanguage
-
renderView
- Specified by:
renderView
in classViewDeclarationLanguage
- Throws:
IOException
-
createView
Process the specification required algorithm that is generic to all PDL.- Overrides:
createView
in classViewDeclarationLanguageBase
-
restoreView
- Overrides:
restoreView
in classViewDeclarationLanguageBase
-
calculateViewId
Calculates the effective view identifier for the specified raw view identifier.- Specified by:
calculateViewId
in classViewDeclarationLanguageBase
- Parameters:
context
- le current FacesContextviewId
- the raw view identifier- Returns:
- the effective view identifier
-
createCompiler
Creates the Facelet page compiler.- Parameters:
context
- the current FacesContext- Returns:
- the application's Facelet page compiler
-
createFaceletFactory
Creates a FaceletFactory instance using the specified compiler.- Parameters:
context
- the current FacesContextcompiler
- the compiler to be used by the factory- Returns:
- the factory used by this VDL to load pages
-
createResponseWriter
protected ResponseWriter createResponseWriter(FacesContext context) throws IOException, FacesException - Throws:
IOException
FacesException
-
getResponseContentType
Generate the content type- Parameters:
context
-orig
-- Returns:
-
getResponseEncoding
Generate the encoding- Parameters:
context
-orig
-- Returns:
-
handleFaceletNotFound
protected void handleFaceletNotFound(FacesContext context, String viewId) throws FacesException, IOException - Throws:
FacesException
IOException
-
handleRenderException
protected void handleRenderException(FacesContext context, Exception e) throws IOException, jakarta.el.ELException, FacesException - Throws:
IOException
jakarta.el.ELException
FacesException
-
loadDecorators
Load the various decorators for Facelets.- Parameters:
context
- the current FacesContextcompiler
- the page compiler
-
loadLibraries
Load the various tag libraries for Facelets.- Parameters:
context
- the current FacesContextcompiler
- the page compiler
-
loadOptions
Load the various options for Facelets compiler. Currently only comment skipping is supported.- Parameters:
context
- the current FacesContextcompiler
- the page compiler
-
sendSourceNotFound
Send a source not found to the client. Although it can be considered ok in JSP mode, I think it's pretty lame to have this kind of requirement at VDL level considering VDL represents the page --> Faces tree link, not the transport layer required to send a SC_NOT_FOUND.- Specified by:
sendSourceNotFound
in classViewDeclarationLanguageBase
- Parameters:
context
- le current FacesContextmessage
- the message associated with the error
-
calculateResourceLibraryContracts
- Overrides:
calculateResourceLibraryContracts
in classViewDeclarationLanguage
-
getFaceletFactory
-
createComponent
public UIComponent createComponent(FacesContext context, String taglibURI, String tagName, Map<String, Object> attributes) - Overrides:
createComponent
in classViewDeclarationLanguage
-
getViews
public Stream<String> getViews(FacesContext facesContext, String path, int maxDepth, ViewVisitOption... options) - Overrides:
getViews
in classViewDeclarationLanguage
-