Package org.omnifaces.facesviews
Class FacesViewsViewHandler
- java.lang.Object
-
- jakarta.faces.application.ViewHandler
-
- jakarta.faces.application.ViewHandlerWrapper
-
- org.omnifaces.facesviews.FacesViewsViewHandler
-
- All Implemented Interfaces:
FacesWrapper<ViewHandler>
public class FacesViewsViewHandler extends ViewHandlerWrapper
View handler that renders an action URL extensionless if a resource is a mapped one, and faces views has been set to always render extensionless or if the current request is extensionless, otherwise as-is.Implementation note: this is installed by
ApplicationProcessor
during thePostConstructApplicationEvent
, in which it's guaranteed that Faces initialization (typically done via aServletContextListener
) has been done. Setting a view handler programmatically requires the FacesApplication
to be present which isn't the case before Faces initialization has been done.Additionally, the view handler needs to be set BEFORE the first faces request is processed. Putting the view handler setting code in a
Filter.init(jakarta.servlet.FilterConfig)
method only works when all init methods are called during startup, OR when the filter filters every request.For a guide on FacesViews, please see the package summary.
- Since:
- 1.3
- Author:
- Arjan Tijms
- See Also:
FacesViews
,ApplicationProcessor
-
-
Field Summary
-
Fields inherited from class jakarta.faces.application.ViewHandler
CHARACTER_ENCODING_KEY, DEFAULT_FACELETS_SUFFIX, DEFAULT_SUFFIX, DEFAULT_SUFFIX_PARAM_NAME, DISABLE_FACELET_JSF_VIEWHANDLER_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
Constructors Constructor Description FacesViewsViewHandler(ViewHandler wrapped)
Construct faces views view handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
deriveViewId(FacesContext context, String viewId)
String
getActionURL(FacesContext context, String viewId)
String
getBookmarkableURL(FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
An override to create bookmarkable URLs via standard outcome target components that take into account<o:pathParam>
tags nested in the components.-
Methods inherited from class jakarta.faces.application.ViewHandlerWrapper
addProtectedView, calculateCharacterEncoding, calculateLocale, calculateRenderKitId, createView, deriveLogicalViewId, getProtectedViewsUnmodifiable, getRedirectURL, getResourceURL, getViewDeclarationLanguage, getViews, getViews, getWebsocketURL, getWrapped, initView, removeProtectedView, renderView, restoreView, writeState
-
-
-
-
Constructor Detail
-
FacesViewsViewHandler
public FacesViewsViewHandler(ViewHandler wrapped)
Construct faces views view handler.- Parameters:
wrapped
- The view handler to be wrapped.
-
-
Method Detail
-
deriveViewId
public String deriveViewId(FacesContext context, String viewId)
- Overrides:
deriveViewId
in classViewHandlerWrapper
-
getActionURL
public String getActionURL(FacesContext context, String viewId)
- Overrides:
getActionURL
in classViewHandlerWrapper
-
getBookmarkableURL
public String getBookmarkableURL(FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
An override to create bookmarkable URLs via standard outcome target components that take into account<o:pathParam>
tags nested in the components. The path parameters will be rendered in the order they were declared for a view id that is defined as a multi view and if the view was not defined as a multi view then they won't be rendered at all. Additionally, declaring path parameters for a non-multi view will be logged as a warning and a faces warning message will be added forDevelopment
stage.- Overrides:
getBookmarkableURL
in classViewHandlerWrapper
- See Also:
PathParam
-
-