Class ViewHandlerWrapper
- java.lang.Object
-
- jakarta.faces.application.ViewHandler
-
- jakarta.faces.application.ViewHandlerWrapper
-
- All Implemented Interfaces:
FacesWrapper<ViewHandler>
public abstract class ViewHandlerWrapper extends ViewHandler implements FacesWrapper<ViewHandler>
see Javadoc of Faces Specification
-
-
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
Constructors Constructor Description ViewHandlerWrapper()
Deprecated.ViewHandlerWrapper(ViewHandler delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProtectedView(String urlPattern)
String
calculateCharacterEncoding(FacesContext context)
Locale
calculateLocale(FacesContext context)
Return the Locale object that should be used when rendering this view to the current user.String
calculateRenderKitId(FacesContext context)
Return the id of an available render-kit that should be used to map the Faces components into user presentation.UIViewRoot
createView(FacesContext context, String viewId)
Build a root node for a component tree.String
deriveLogicalViewId(FacesContext context, String rawViewId)
String
deriveViewId(FacesContext context, String input)
String
getActionURL(FacesContext context, String viewId)
Returns a URL, suitable for encoding and rendering, that (if activated) will cause the Faces request processing lifecycle for the specified viewId to be executedString
getBookmarkableURL(FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
Return a Faces action URL derived from the viewId argument that is suitable to be used as the target of a link in a Faces response.Set<String>
getProtectedViewsUnmodifiable()
String
getRedirectURL(FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
Return a Faces action URL derived from the viewId argument that is suitable to be used by the NavigationHandler to issue a redirect request to the URL using a NonFaces request.String
getResourceURL(FacesContext context, String path)
Returns a URL, suitable for encoding and rendering, that (if activated) will retrieve the specified web application resource.ViewDeclarationLanguage
getViewDeclarationLanguage(FacesContext context, String viewId)
Return the ViewDeclarationLanguage instance used for this ViewHandler instance.Stream<String>
getViews(FacesContext facesContext, String path, int maxDepth, ViewVisitOption... options)
Stream<String>
getViews(FacesContext facesContext, String path, ViewVisitOption... options)
String
getWebsocketURL(FacesContext context, String channelAndToken)
Return a Faces URL that represents a websocket connection for the passed channel and channelTokenViewHandler
getWrapped()
A class that implements this interface uses this method to return an instance of the class being wrapped.void
initView(FacesContext context)
Initialize the view for the request processing lifecycle.boolean
removeProtectedView(String urlPattern)
void
renderView(FacesContext context, UIViewRoot viewToRender)
Perform whatever actions are required to render the response view to the response object associated with the current FacesContext.UIViewRoot
restoreView(FacesContext context, String viewId)
Perform whatever actions are required to restore the view associated with the specified FacesContext and viewId.void
writeState(FacesContext context)
Take any appropriate action to either immediately write out the current state information (by calling StateManager.writeState(jakarta.faces.context.FacesContext, java.lang.Object), or noting where state information should later be written.
-
-
-
Constructor Detail
-
ViewHandlerWrapper
@Deprecated public ViewHandlerWrapper()
Deprecated.
-
ViewHandlerWrapper
public ViewHandlerWrapper(ViewHandler delegate)
-
-
Method Detail
-
calculateCharacterEncoding
public String calculateCharacterEncoding(FacesContext context)
- Overrides:
calculateCharacterEncoding
in classViewHandler
-
initView
public void initView(FacesContext context) throws FacesException
Description copied from class:ViewHandler
Initialize the view for the request processing lifecycle.This method must be called at the beginning of the Restore View Phase of the Request Processing Lifecycle. It is responsible for performing any per-request initialization necessary to the operation of the lifycecle.
The default implementation must perform the following actions. If ExternalContext.getRequestCharacterEncoding() returns null, call calculateCharacterEncoding(jakarta.faces.context.FacesContext) and pass the result, if non-null, into the ExternalContext.setRequestCharacterEncoding(java.lang.String) method. If ExternalContext.getRequestCharacterEncoding() returns non-null take no action.
- Overrides:
initView
in classViewHandler
- Throws:
FacesException
-
getWrapped
public ViewHandler getWrapped()
Description copied from interface:FacesWrapper
A class that implements this interface uses this method to return an instance of the class being wrapped.- Specified by:
getWrapped
in interfaceFacesWrapper<ViewHandler>
- Returns:
- the instance of the class being wrapped
-
renderView
public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException, FacesException
Description copied from class:ViewHandler
Perform whatever actions are required to render the response view to the response object associated with the current FacesContext.Otherwise, the default implementation must obtain a reference to the ViewDeclarationLanguage for the viewId of the argument viewToRender and call its ViewDeclarationLanguage.renderView(jakarta.faces.context.FacesContext, jakarta.faces.component.UIViewRoot) method, returning the result and not swallowing any exceptions thrown by that method.
- Specified by:
renderView
in classViewHandler
- Throws:
IOException
FacesException
-
writeState
public void writeState(FacesContext context) throws IOException
Description copied from class:ViewHandler
Take any appropriate action to either immediately write out the current state information (by calling StateManager.writeState(jakarta.faces.context.FacesContext, java.lang.Object), or noting where state information should later be written.This method must do nothing if the current request is an Ajax request. When responding to Ajax requests, the state is obtained by calling StateManager.getViewState(jakarta.faces.context.FacesContext) and then written into the Ajax response during final encoding (UIViewRoot.encodeEnd(jakarta.faces.context.FacesContext).
- Specified by:
writeState
in classViewHandler
- Throws:
IOException
-
calculateRenderKitId
public String calculateRenderKitId(FacesContext context)
Description copied from class:ViewHandler
Return the id of an available render-kit that should be used to map the Faces components into user presentation.The render-kit selected (eg html, xhtml, pdf, xul, ...) may depend upon the user, properties associated with the request, etc.
- Specified by:
calculateRenderKitId
in classViewHandler
-
calculateLocale
public Locale calculateLocale(FacesContext context)
Description copied from class:ViewHandler
Return the Locale object that should be used when rendering this view to the current user.Some request protocols allow an application user to specify what locale they prefer the response to be in. For example, HTTP requests can specify the "accept-language" header.
Method
Application.getSupportedLocales()
defines what locales this Faces application is capable of supporting.This method should match such sources of data up and return the Locale object that is the best choice for rendering the current application to the current user.
- Specified by:
calculateLocale
in classViewHandler
-
restoreView
public UIViewRoot restoreView(FacesContext context, String viewId)
Description copied from class:ViewHandler
Perform whatever actions are required to restore the view associated with the specified FacesContext and viewId. It may delegate to the restoreView of the associated StateManager to do the actual work of restoring the view. If there is no available state for the specified viewId, return null.Otherwise, the default implementation must obtain a reference to the ViewDeclarationLanguage for this viewId and call its ViewDeclarationLanguage.restoreView(jakarta.faces.context.FacesContext, java.lang.String) method, returning the result and not swallowing any exceptions thrown by that method.
- Specified by:
restoreView
in classViewHandler
-
getResourceURL
public String getResourceURL(FacesContext context, String path)
Description copied from class:ViewHandler
Returns a URL, suitable for encoding and rendering, that (if activated) will retrieve the specified web application resource.- Specified by:
getResourceURL
in classViewHandler
-
getActionURL
public String getActionURL(FacesContext context, String viewId)
Description copied from class:ViewHandler
Returns a URL, suitable for encoding and rendering, that (if activated) will cause the Faces request processing lifecycle for the specified viewId to be executed- Specified by:
getActionURL
in classViewHandler
-
createView
public UIViewRoot createView(FacesContext context, String viewId)
Description copied from class:ViewHandler
Build a root node for a component tree.When a request is received, this method is called if restoreView returns null, ie this is not a "postback". In this case, a root node is created and then renderView is invoked. It is the responsibility of the renderView method to build the full component tree (ie populate the UIViewRoot with descendant nodes).
This method is also invoked when navigation occurs from one view to another, where the viewId passed is the id of the new view to be displayed. Again it is the responsibility of renderView to then populate the viewroot with descendants.
The locale and renderKit settings are inherited from the current UIViewRoot that is configured before this method is called. That means of course that they do NOT get set for GET requests, including navigation that has the redirect flag set.
- Specified by:
createView
in classViewHandler
-
deriveViewId
public String deriveViewId(FacesContext context, String input)
- Overrides:
deriveViewId
in classViewHandler
- Returns:
-
deriveLogicalViewId
public String deriveLogicalViewId(FacesContext context, String rawViewId)
- Overrides:
deriveLogicalViewId
in classViewHandler
- Returns:
-
getBookmarkableURL
public String getBookmarkableURL(FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
Description copied from class:ViewHandler
Return a Faces action URL derived from the viewId argument that is suitable to be used as the target of a link in a Faces response. Compiliant implementations must implement this method as specified in section Faces.7.5.2. The default implementation simply calls through to getActionURL(jakarta.faces.context.FacesContext, java.lang.String), passing the arguments context and viewId.- Overrides:
getBookmarkableURL
in classViewHandler
- Returns:
-
getRedirectURL
public String getRedirectURL(FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
Description copied from class:ViewHandler
Return a Faces action URL derived from the viewId argument that is suitable to be used by the NavigationHandler to issue a redirect request to the URL using a NonFaces request. Compiliant implementations must implement this method as specified in section Faces.7.5.2. The default implementation simply calls through to getActionURL(jakarta.faces.context.FacesContext, java.lang.String), passing the arguments context and viewId.- Overrides:
getRedirectURL
in classViewHandler
- Returns:
-
getViewDeclarationLanguage
public ViewDeclarationLanguage getViewDeclarationLanguage(FacesContext context, String viewId)
Description copied from class:ViewHandler
Return the ViewDeclarationLanguage instance used for this ViewHandler instance.The default implementation of this method returns null.
- Overrides:
getViewDeclarationLanguage
in classViewHandler
- Returns:
-
getProtectedViewsUnmodifiable
public Set<String> getProtectedViewsUnmodifiable()
- Overrides:
getProtectedViewsUnmodifiable
in classViewHandler
- Returns:
-
removeProtectedView
public boolean removeProtectedView(String urlPattern)
- Overrides:
removeProtectedView
in classViewHandler
-
addProtectedView
public void addProtectedView(String urlPattern)
- Overrides:
addProtectedView
in classViewHandler
-
getWebsocketURL
public String getWebsocketURL(FacesContext context, String channelAndToken)
Description copied from class:ViewHandler
Return a Faces URL that represents a websocket connection for the passed channel and channelToken- Specified by:
getWebsocketURL
in classViewHandler
- Returns:
-
getViews
public Stream<String> getViews(FacesContext facesContext, String path, int maxDepth, ViewVisitOption... options)
- Overrides:
getViews
in classViewHandler
- Returns:
-
getViews
public Stream<String> getViews(FacesContext facesContext, String path, ViewVisitOption... options)
- Overrides:
getViews
in classViewHandler
- Returns:
-
-