java.lang.Object
jakarta.faces.application.ViewHandler
jakarta.faces.application.ViewHandlerWrapper
org.omnifaces.viewhandler.OmniViewHandler
- All Implemented Interfaces:
FacesWrapper<ViewHandler>
OmniFaces view handler.
This class was before version 2.5 known as
RestorableViewHandler.
This view handler performs the following tasks:
- Since 1.3: Recreate entire view when
EnableRestorableViewtag is in the metadata. This effectively prevents theViewExpiredExceptionon the view. - Since 2.2: Detect unload requests coming from
ViewScopedbeans. This will create a dummy view and only restore the view scoped state instead of building and restoring the entire view. - Since 2.5: If project stage is development, then throw an
IllegalStateExceptionwhen there's a nestedUIFormcomponent. - Since 3.10: If
ViewResourceHandler.isViewResourceRequest(FacesContext)istrue, then replace the HTML response writer with a XML response writer inrenderView(FacesContext, UIViewRoot), and ensure that proper action URL is returned inViewHandlerWrapper.getActionURL(FacesContext, String).
- Since:
- 1.3
- Author:
- Bauke Scholtz
- See Also:
-
Field Summary
Fields inherited from class jakarta.faces.application.ViewHandler
CHARACTER_ENCODING_KEY, DEFAULT_FACELETS_SUFFIX, DEFAULT_SUFFIX, DEFAULT_SUFFIX_PARAM_NAME, FACELETS_BUFFER_SIZE_PARAM_NAME, FACELETS_DECORATORS_PARAM_NAME, FACELETS_LIBRARIES_PARAM_NAME, FACELETS_REFRESH_PERIOD_PARAM_NAME, FACELETS_SKIP_COMMENTS_PARAM_NAME, FACELETS_SUFFIX_PARAM_NAME, FACELETS_VIEW_MAPPINGS_PARAM_NAME -
Constructor Summary
ConstructorsConstructorDescriptionOmniViewHandler(ViewHandler wrapped) Construct a new OmniFaces view handler around the given wrapped view handler. -
Method Summary
Modifier and TypeMethodDescriptioncreateView(FacesContext context, String viewId) If the current request is a sw.js request fromPWAResourceHandler, then create a dummy view and triggerFacesContext.responseComplete()so that it won't be built nor rendered.voidrenderView(FacesContext context, UIViewRoot viewToRender) restoreView(FacesContext context, String viewId) If the current request is an unload request fromViewScoped, then create a dummy view, restore only the view root state and then immediately explicitly destroy the view, else restore the view as usual.Methods inherited from class jakarta.faces.application.ViewHandlerWrapper
addProtectedView, calculateCharacterEncoding, calculateLocale, calculateRenderKitId, deriveLogicalViewId, deriveViewId, getActionURL, getBookmarkableURL, getProtectedViewsUnmodifiable, getRedirectURL, getResourceURL, getViewDeclarationLanguage, getViews, getViews, getWebsocketURL, getWrapped, initView, removeProtectedView, writeState
-
Constructor Details
-
OmniViewHandler
Construct a new OmniFaces view handler around the given wrapped view handler.- Parameters:
wrapped- The wrapped view handler.
-
-
Method Details
-
createView
If the current request is a sw.js request fromPWAResourceHandler, then create a dummy view and triggerFacesContext.responseComplete()so that it won't be built nor rendered.- Overrides:
createViewin classViewHandlerWrapper
-
restoreView
If the current request is an unload request fromViewScoped, then create a dummy view, restore only the view root state and then immediately explicitly destroy the view, else restore the view as usual. If the<o:enableRestoreView>is used once in the application, and the restored view is null and the current request is a postback, then recreate and rebuild the view from scratch. If it indeed contains the<o:enableRestoreView>, then return the newly created view, else returnnull.- Overrides:
restoreViewin classViewHandlerWrapper
-
renderView
- Overrides:
renderViewin classViewHandlerWrapper- Throws:
IOException
-