org.omnifaces.viewhandler
Class RestorableViewHandler

java.lang.Object
  extended by javax.faces.application.ViewHandler
      extended by javax.faces.application.ViewHandlerWrapper
          extended by org.omnifaces.viewhandler.RestorableViewHandler
All Implemented Interfaces:
javax.faces.FacesWrapper<javax.faces.application.ViewHandler>

public class RestorableViewHandler
extends javax.faces.application.ViewHandlerWrapper

This view handler implementation will recreate the entire view state whenever the view has apparently been expired, i.e. whenever restoreView(FacesContext, String) returns null and the current request is a postback and the view in question has <enableRestorableView> in the metadata. This effectively prevents the ViewExpiredException on the view.

Since:
1.3
Author:
Bauke Scholtz
See Also:
EnableRestorableView

Field Summary
 
Fields inherited from class javax.faces.application.ViewHandler
CHARACTER_ENCODING_KEY, DEFAULT_FACELETS_SUFFIX, DEFAULT_SUFFIX, DEFAULT_SUFFIX_PARAM_NAME, FACELETS_SUFFIX_PARAM_NAME, FACELETS_VIEW_MAPPINGS_PARAM_NAME
 
Constructor Summary
RestorableViewHandler(javax.faces.application.ViewHandler wrapped)
          Construct a new restorable view handler around the given wrapped view handler.
 
Method Summary
 javax.faces.application.ViewHandler getWrapped()
           
 javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context, java.lang.String viewId)
          First try to restore the view.
 
Methods inherited from class javax.faces.application.ViewHandlerWrapper
calculateCharacterEncoding, calculateLocale, calculateRenderKitId, createView, deriveViewId, getActionURL, getBookmarkableURL, getRedirectURL, getResourceURL, getViewDeclarationLanguage, initView, renderView, writeState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestorableViewHandler

public RestorableViewHandler(javax.faces.application.ViewHandler wrapped)
Construct a new restorable view handler around the given wrapped view handler.

Parameters:
wrapped - The wrapped view handler.
Method Detail

restoreView

public javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context,
                                                    java.lang.String viewId)
First try to restore the view. If it returns null and the current request is a postback, then recreate and build the view. If it contains the <o:enableRestoreView>, then return the newly created view, else return null.

Overrides:
restoreView in class javax.faces.application.ViewHandlerWrapper

getWrapped

public javax.faces.application.ViewHandler getWrapped()
Specified by:
getWrapped in interface javax.faces.FacesWrapper<javax.faces.application.ViewHandler>
Overrides:
getWrapped in class javax.faces.application.ViewHandlerWrapper