Package org.apache.myfaces.view.facelets
Class ViewPoolProcessor
java.lang.Object
org.apache.myfaces.view.facelets.ViewPoolProcessor
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 SummaryFieldsModifier and TypeFieldDescriptionstatic final StringFlag to indicate that dispose this view on navigation is valid.static final StringUIViewRoot attribute to enable/disable the view for use pooling.static final StringFlag 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 final StringParam used to indicate a "deferred navigation" needs to be done.static final IntegerIndicates 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 final IntegerIndicates no reset should be done on this state savingstatic final IntegerIndicates 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 final StringAttribute of UIViewRoot that indicates if a soft (1) or hard(2) (reset and check) reset is required in the call to saveState().
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclearTransientAndNonFaceletComponentsForDynamicView(FacesContext context, UIViewRoot root, ViewStructureMetadata viewStructureMetadata) protected voidvoidcloneAndRestoreView(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.voiddisposeView(FacesContext facesContext, UIViewRoot root) static ViewPoolProcessorgetInstance(FacesContext context) getViewPool(FacesContext context, UIViewRoot root) static voidinitialize(FacesContext context) This method should be called at startup to decide if a view processor should be provided or not to the runtime.booleanisViewPoolEnabledForThisView(FacesContext context, UIViewRoot root) booleanisViewPoolStrategyAllowedForThisView(FacesContext context, UIViewRoot root) voidprocessDeferredNavigation(FacesContext facesContext) voidpushPartialView(FacesContext context, UIViewRoot view, FaceletState faceletViewState, int count) voidpushResetableView(FacesContext context, UIViewRoot view, FaceletState faceletViewState) retrieveViewStructureMetadata(FacesContext context, UIViewRoot root) voidsetViewPoolDisabledOnThisView(FacesContext context, UIViewRoot root, boolean value) voidstoreViewStructureMetadata(FacesContext context, UIViewRoot root) 
- 
Field Details- 
ENABLE_VIEW_POOLUIViewRoot attribute to enable/disable the view for use pooling.- See Also:
 
- 
FORCE_HARD_RESETFlag 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:
 
- 
DISPOSE_VIEW_NAVIGATIONFlag to indicate that dispose this view on navigation is valid.- See Also:
 
- 
RESET_SAVE_STATE_MODE_KEYAttribute of UIViewRoot that indicates if a soft (1) or hard(2) (reset and check) reset is required in the call to saveState().- See Also:
 
- 
RESET_MODE_OFFIndicates no reset should be done on this state saving
- 
RESET_MODE_SOFTIndicates 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_HARDIndicates 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_NAVIGATIONParam 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:
 
 
- 
- 
Constructor Details- 
ViewPoolProcessor
 
- 
- 
Method Details- 
getInstance
- 
initializeThis method should be called at startup to decide if a view processor should be provided or not to the runtime.- Parameters:
- context-
 
- 
getViewPool
- 
isViewPoolEnabledForThisView
- 
isViewPoolStrategyAllowedForThisView
- 
setViewPoolDisabledOnThisView
- 
cloneAndRestoreViewpublic 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
- 
retrieveViewStructureMetadata
- 
pushResetableView
- 
pushPartialViewpublic void pushPartialView(FacesContext context, UIViewRoot view, FaceletState faceletViewState, int count) 
- 
clearTransientAndNonFaceletComponentsForStaticViewprotected void clearTransientAndNonFaceletComponentsForStaticView(FacesContext context, UIViewRoot root) 
- 
clearTransientAndNonFaceletComponentsForDynamicViewpublic void clearTransientAndNonFaceletComponentsForDynamicView(FacesContext context, UIViewRoot root, ViewStructureMetadata viewStructureMetadata) 
- 
disposeView
 
-