MultiViewHandler
@Deprecated public class ViewHandlerImpl extends ViewHandler
This is the default implementation for JSF 1.2.
While this class isn't used by the 2.0 runtime, it's kept for binary compatibility with those that extend from this class directly.
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 and Description |
---|
ViewHandlerImpl()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Locale |
calculateLocale(FacesContext context)
Deprecated.
Returns an appropriate
Locale to use for this and subsequent requests for the current
client. |
String |
calculateRenderKitId(FacesContext context)
Deprecated.
Return an appropriate
renderKitId for this and subsequent requests from the
current client. |
UIViewRoot |
createView(FacesContext context,
String viewId)
Deprecated.
Create and return a new
UIViewRoot
instance initialized with information from the argument FacesContext and
viewId . |
protected Locale |
findMatch(FacesContext context,
Locale pref)
Deprecated.
Attempts to find a matching locale based on
pref and list of supported locales,
using the matching algorithm as described in JSTL 8.3.2. |
String |
getActionURL(FacesContext context,
String viewId)
Deprecated.
If the value returned from this method is used as
the |
String |
getResourceURL(FacesContext context,
String path)
Deprecated.
If the value returned from this method is used as the |
String |
getWebsocketURL(FacesContext context,
String channel)
Deprecated.
If the value returned from this method is used as the |
void |
initView(FacesContext context)
Deprecated.
Do not call the default implementation of
ViewHandler.initView(javax.faces.context.FacesContext) if the
ExternalContext.getRequestCharacterEncoding() returns a
non-null result. |
void |
renderView(FacesContext context,
UIViewRoot viewToRender)
Deprecated.
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)
Deprecated.
Perform whatever actions are required to restore
the view associated with the specified
FacesContext and viewId . |
void |
writeState(FacesContext context)
Deprecated.
Take any appropriate action to either immediately write out the current state information (by
calling
StateManager.writeState(javax.faces.context.FacesContext, java.lang.Object) , or noting where state information should later be
written. |
addProtectedView, calculateCharacterEncoding, deriveLogicalViewId, deriveViewId, getBookmarkableURL, getProtectedViewsUnmodifiable, getRedirectURL, getViewDeclarationLanguage, getViews, getViews, removeProtectedView
public void initView(FacesContext context) throws FacesException
ViewHandler.initView(javax.faces.context.FacesContext)
if the
ExternalContext.getRequestCharacterEncoding()
returns a
non-null
result.initView
in class ViewHandler
context
- the Faces context.FacesException
- if a problem occurs setting the encoding, such as the
UnsupportedEncodingException
thrown by the underlying Jakarta Servlet or
Portlet technology when the encoding is not supported.ViewHandler.initView(javax.faces.context.FacesContext)
public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException, FacesException
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(javax.faces.context.FacesContext, javax.faces.component.UIViewRoot)
method,
returning the result and not swallowing any exceptions thrown by that method.
renderView
in class ViewHandler
context
- FacesContext
for the current requestviewToRender
- the view to renderIOException
- if an input/output error occursFacesException
- if a Jakarta Servlet error occurspublic UIViewRoot restoreView(FacesContext context, String viewId)
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(javax.faces.context.FacesContext, java.lang.String)
method, returning the result and not swallowing
any exceptions thrown by that method.
restoreView
in class ViewHandler
context
- FacesContext
for the current requestviewId
- the view identifier for the current requestpublic UIViewRoot createView(FacesContext context, String viewId)
ViewHandler
Create and return a new UIViewRoot
instance initialized with information from the argument FacesContext
and
viewId
. Locate the
ViewDeclarationLanguage
implementation for the VDL used in the view. The argument
viewId
must be converted to a physical viewId
that can refer to an
actual resource suitable for use by the ViewDeclarationLanguage
ViewDeclarationLanguage.createView(javax.faces.context.FacesContext, java.lang.String)
, which must be called by this method.
createView
in class ViewHandler
context
- the Faces context.viewId
- the view id.public Locale calculateLocale(FacesContext context)
ViewHandler
Returns an appropriate Locale
to use for this and subsequent requests for the current
client.
calculateLocale
in class ViewHandler
context
- FacesContext
for the current requestpublic String calculateRenderKitId(FacesContext context)
ViewHandler
Return an appropriate renderKitId
for this and subsequent requests from the
current client. It is an error for this method to return null
.
The default return value is
RenderKitFactory.HTML_BASIC_RENDER_KIT
.
calculateRenderKitId
in class ViewHandler
context
- FacesContext
for the current requestprotected Locale findMatch(FacesContext context, Locale pref)
pref
and list of supported locales,
using the matching algorithm as described in JSTL 8.3.2.context
- the FacesContext
for the current requestpref
- the preferred localepublic void writeState(FacesContext context) throws IOException
ViewHandler
Take any appropriate action to either immediately write out the current state information (by
calling StateManager.writeState(javax.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(javax.faces.context.FacesContext)
and then written into the Ajax
response during
final encoding
(PartialViewContext.processPartial(javax.faces.event.PhaseId)
)
.
writeState
in class ViewHandler
context
- FacesContext
for the current requestIOException
- if an input/output error occurspublic String getActionURL(FacesContext context, String viewId)
ViewHandler
If the value returned from this method is used as
the file
argument to the four-argument constructor for java.net.URL
(assuming appropriate values are used for the first three arguments), then a client making a
request to the toExternalForm()
of that URL
will select the
argument viewId
for traversing the Jakarta Server Faces lifecycle. Please see section JSF.7.6.2
for the complete specification, especially for details
related to view protection using the
ResponseStateManager.NON_POSTBACK_VIEW_TOKEN_PARAM
and the behavior when the current request is to a URL
for which the FacesServlet has an exact mapping as defined by Servlet.12.2.
getActionURL
in class ViewHandler
context
- FacesContext
for this requestviewId
- View identifier of the desired viewpublic String getResourceURL(FacesContext context, String path)
ViewHandler
If the value returned from this method is used as the file
argument to the
four-argument constructor for java.net.URL
(assuming appropriate values are used
for the first three arguments), then a client making a request to the
toExternalForm()
of that URL
will select the argument
path
for direct rendering. If the specified path starts with a slash, it must be
treated as context relative; otherwise, it must be treated as relative to the action URL of
the current view.
getResourceURL
in class ViewHandler
context
- FacesContext
for the current requestpath
- Resource path to convert to a URLpublic String getWebsocketURL(FacesContext context, String channel)
ViewHandler
If the value returned from this method is used as the file
argument to the
four-argument constructor for java.net.URL
(assuming appropriate values are used
for the first three arguments), then a client making a push handshake request to the
toExternalForm()
of that URL
will select the argument
channel
for connecting the websocket push channel in the current view. It must
match the PushContext.URI_PREFIX
of the endpoint.
getWebsocketURL
in class ViewHandler
context
- FacesContext
for the current request.channel
- The channel name of the websocket.PushContext.URI_PREFIX
Comments to: faces-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.