Package org.apache.myfaces.view.facelets
Class ViewPoolProcessor
- java.lang.Object
-
- org.apache.myfaces.view.facelets.ViewPoolProcessor
-
public class ViewPoolProcessor extends Object
This class is reponsible for all processing tasks related to the view pool. For enable the pool only for a subset of your views, you can add an entry inside faces-config.xml file like this:<faces-config-extension> <view-pool-mapping> <url-pattern>/*</url-pattern> <parameter> <name>org.apache.myfaces.VIEW_POOL_MAX_POOL_SIZE</name> <value>5</value> </parameter> </view-pool-mapping> </faces-config-extension>
- Author:
- Leonardo Uribe
-
-
Field Summary
Fields Modifier and Type Field Description static String
DISPOSE_VIEW_NAVIGATION
Flag to indicate that dispose this view on navigation is valid.static String
ENABLE_VIEW_POOL
UIViewRoot attribute to enable/disable the view for use pooling.static String
FORCE_HARD_RESET
Flag that indicates to the StateManagementStrategy that no state needs to be stored and we are using saveState() to dispose the view and store it into the pool directly.static String
INVOKE_DEFERRED_NAVIGATION
Param used to indicate a "deferred navigation" needs to be done.static Integer
RESET_MODE_HARD
Indicates a hard reset should be done when saveState(...) is performed, which means all transient and delta state should be cleared, destroying all existing state in the process.static Integer
RESET_MODE_OFF
Indicates no reset should be done on this state savingstatic Integer
RESET_MODE_SOFT
Indicates a soft reset should be done when saveState(...) is performed, which means all transient state should be cleared but the delta state should not be destroyed in the process.static String
RESET_SAVE_STATE_MODE_KEY
Attribute of UIViewRoot that indicates if a soft (1) or hard(2) (reset and check) reset is required in the call to saveState().
-
Constructor Summary
Constructors Constructor Description ViewPoolProcessor(FacesContext context)
-
Method Summary
-
-
-
Field Detail
-
ENABLE_VIEW_POOL
public static final String ENABLE_VIEW_POOL
UIViewRoot attribute to enable/disable the view for use pooling.- See Also:
- Constant Field Values
-
FORCE_HARD_RESET
public static final String FORCE_HARD_RESET
Flag that indicates to the StateManagementStrategy that no state needs to be stored and we are using saveState() to dispose the view and store it into the pool directly.- See Also:
- Constant Field Values
-
DISPOSE_VIEW_NAVIGATION
public static final String DISPOSE_VIEW_NAVIGATION
Flag to indicate that dispose this view on navigation is valid.- See Also:
- Constant Field Values
-
RESET_SAVE_STATE_MODE_KEY
public static final String RESET_SAVE_STATE_MODE_KEY
Attribute of UIViewRoot that indicates if a soft (1) or hard(2) (reset and check) reset is required in the call to saveState().- See Also:
- Constant Field Values
-
RESET_MODE_OFF
public static final Integer RESET_MODE_OFF
Indicates no reset should be done on this state saving
-
RESET_MODE_SOFT
public static final Integer RESET_MODE_SOFT
Indicates a soft reset should be done when saveState(...) is performed, which means all transient state should be cleared but the delta state should not be destroyed in the process.
-
RESET_MODE_HARD
public static final Integer RESET_MODE_HARD
Indicates a hard reset should be done when saveState(...) is performed, which means all transient and delta state should be cleared, destroying all existing state in the process. If something cannot be reseted, the state should return non null, so the algorithm can remove the component from the tree and mark the tree as partial (requires refresh before reuse).
-
INVOKE_DEFERRED_NAVIGATION
public static final String INVOKE_DEFERRED_NAVIGATION
Param used to indicate a "deferred navigation" needs to be done. To allow the view pool to dispose the view properly (and reuse it later), it is necessary to ensure the view is not being used at the moment. If the navigation call occur inside an action listener, the current view is being used and cannot be disposed (because it conflicts with hard/soft reset). This extension allows to call handleNavigation() before end invoke application phase, but after traverse the component tree.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ViewPoolProcessor
public ViewPoolProcessor(FacesContext context)
-
-
Method Detail
-
getInstance
public static ViewPoolProcessor getInstance(FacesContext context)
-
initialize
public static void initialize(FacesContext context)
This method should be called at startup to decide if a view processor should be provided or not to the runtime.- Parameters:
context
-
-
getViewPool
public ViewPool getViewPool(FacesContext context, UIViewRoot root)
-
isViewPoolEnabledForThisView
public boolean isViewPoolEnabledForThisView(FacesContext context, UIViewRoot root)
-
isViewPoolStrategyAllowedForThisView
public boolean isViewPoolStrategyAllowedForThisView(FacesContext context, UIViewRoot root)
-
setViewPoolDisabledOnThisView
public void setViewPoolDisabledOnThisView(FacesContext context, UIViewRoot root, boolean value)
-
cloneAndRestoreView
public void cloneAndRestoreView(FacesContext context, UIViewRoot newView, ViewEntry entry, ViewStructureMetadata metadata)
Takes the newView and restore the state taken as base the provided ViewEntry, and then move all child components from oldView to newView, to finally obtain a clean component tree.- Parameters:
context
-newView
-entry
-
-
storeViewStructureMetadata
public void storeViewStructureMetadata(FacesContext context, UIViewRoot root)
-
retrieveViewStructureMetadata
public ViewStructureMetadata retrieveViewStructureMetadata(FacesContext context, UIViewRoot root)
-
pushResetableView
public void pushResetableView(FacesContext context, UIViewRoot view, FaceletState faceletViewState)
-
pushPartialView
public void pushPartialView(FacesContext context, UIViewRoot view, FaceletState faceletViewState, int count)
-
clearTransientAndNonFaceletComponentsForStaticView
protected void clearTransientAndNonFaceletComponentsForStaticView(FacesContext context, UIViewRoot root)
-
clearTransientAndNonFaceletComponentsForDynamicView
public void clearTransientAndNonFaceletComponentsForDynamicView(FacesContext context, UIViewRoot root, ViewStructureMetadata viewStructureMetadata)
-
processDeferredNavigation
public void processDeferredNavigation(FacesContext facesContext)
-
disposeView
public void disposeView(FacesContext facesContext, UIViewRoot root)
-
-