public class ViewHandlerProxy
extends javax.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 and Description |
|---|
ViewHandlerProxy(String scriptName,
javax.faces.application.ViewHandler vhDelegate) |
| Modifier and Type | Method and Description |
|---|---|
String |
calculateCharacterEncoding(javax.faces.context.FacesContext context)
Returns the correct character encoding to be used for this request.
|
Locale |
calculateLocale(javax.faces.context.FacesContext context)
Returns an appropriate
Locale to use for this and
subsequent requests for the current client. |
String |
calculateRenderKitId(javax.faces.context.FacesContext context)
Return an appropriate
renderKitId for this and
subsequent requests from the current client. |
javax.faces.component.UIViewRoot |
createView(javax.faces.context.FacesContext context,
String viewId)
Create and
return a new
UIViewRoot instance initialized with
information from the argument FacesContext and
viewId. |
String |
deriveLogicalViewId(javax.faces.context.FacesContext context,
String input)
Derive and return the viewId from the current request, or the argument input by following the algorithm defined in specification section JSF.7.6.2. |
String |
deriveViewId(javax.faces.context.FacesContext context,
String input)
Derive and return the viewId from the current request, or the argument input by following the algorithm defined in specification section JSF.7.6.2. |
String |
getActionURL(javax.faces.context.FacesContext context,
String viewId)
If
the value returned from this
method is used as the |
String |
getBookmarkableURL(javax.faces.context.FacesContext context,
String viewId,
Map<String,List<String>> parameters,
boolean includeViewParams)
Return a JSF action URL derived from the viewId argument that is suitable to be used as the target of a link in a JSF response. |
String |
getRedirectURL(javax.faces.context.FacesContext context,
String viewId,
Map<String,List<String>> parameters,
boolean includeViewParams)
Return a JSF action URL derived
from the |
String |
getResourceURL(javax.faces.context.FacesContext context,
String path)
If the value returned from this
method is used as the |
javax.faces.view.ViewDeclarationLanguage |
getViewDeclarationLanguage(javax.faces.context.FacesContext context,
String viewId)
Return
the |
String |
getWebsocketURL(javax.faces.context.FacesContext context,
String channel)
If the value returned from this
method is used as the |
void |
initView(javax.faces.context.FacesContext context)
Initialize the view
for the request processing lifecycle.
|
void |
renderView(javax.faces.context.FacesContext context,
javax.faces.component.UIViewRoot viewToRender)
Perform whatever
actions are required to render the response view to the response
object associated with the current
FacesContext. |
javax.faces.component.UIViewRoot |
restoreView(javax.faces.context.FacesContext context,
String viewId)
Perform whatever
actions are required to restore the view associated with the
specified
FacesContext and viewId. |
void |
writeState(javax.faces.context.FacesContext context)
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. |
public ViewHandlerProxy(String scriptName, javax.faces.application.ViewHandler vhDelegate)
public String calculateCharacterEncoding(javax.faces.context.FacesContext context)
javax.faces.application.ViewHandlerReturns the correct character encoding to be used for this request.
The following algorithm is employed.
Examine the Content-Type request header. If it has
a charset parameter, extract it and return that as the
encoding.
If no charset parameter was found, check for the
existence of a session by calling ExternalContext.getSession(boolean)
passing false as the argument. If that method returns
true, get the session Map by calling
ExternalContext.getSessionMap() and look for a value under the
key given by the value of the symbolic constant
ViewHandler.CHARACTER_ENCODING_KEY.
If present, return the value, converted to String.
Otherwise, return null
calculateCharacterEncoding in class javax.faces.application.ViewHandlercontext - the Faces context.nullpublic void initView(javax.faces.context.FacesContext context)
throws javax.faces.FacesException
javax.faces.application.ViewHandlerInitialize 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 ViewHandler.calculateCharacterEncoding(javax.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.
initView in class javax.faces.application.ViewHandlercontext - the Faces context.javax.faces.FacesException - if a problem occurs setting the encoding,
such as the UnsupportedEncodingException thrown
by the underlying Servlet or Portlet technology when the encoding is not
supported.public Locale calculateLocale(javax.faces.context.FacesContext context)
javax.faces.application.ViewHandlerReturns an appropriate Locale to use for this and
subsequent requests for the current client.
calculateLocale in class javax.faces.application.ViewHandlercontext - FacesContext for the current requestpublic String calculateRenderKitId(javax.faces.context.FacesContext context)
javax.faces.application.ViewHandlerReturn 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 javax.faces.application.ViewHandlercontext - FacesContext for the current requestpublic javax.faces.component.UIViewRoot createView(javax.faces.context.FacesContext context,
String viewId)
javax.faces.application.ViewHandlerCreate 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 javax.faces.application.ViewHandlercontext - the Faces context.viewId - the view id.public String getActionURL(javax.faces.context.FacesContext context, String viewId)
javax.faces.application.ViewHandlerIf
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 JSF 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 javax.faces.application.ViewHandlercontext - FacesContext for this requestviewId - View identifier of the desired viewpublic String getResourceURL(javax.faces.context.FacesContext context, String path)
javax.faces.application.ViewHandlerIf 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 javax.faces.application.ViewHandlercontext - FacesContext for the current requestpath - Resource path to convert to a URLpublic String getWebsocketURL(javax.faces.context.FacesContext context, String channel)
javax.faces.application.ViewHandlerIf 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 javax.faces.application.ViewHandlercontext - FacesContext for the current request.channel - The channel name of the websocket.PushContext.URI_PREFIXpublic String deriveViewId(javax.faces.context.FacesContext context, String input)
javax.faces.application.ViewHandlerDerive and return the viewId from the current request, or the argument input by following the algorithm defined in specification section JSF.7.6.2.
This method should work correctly when the
FacesServlet is invoked via either a path mapping,
extension mapping or an exact match (mapping) as
defined by Servlet.12.2. Note that path mapping is also commonly
known as prefix mapping (e.g. "/faces/*") and extension mapping
as suffix mapping (e.g. "*.xhtml"). An exact match is possible
where there's a servlet mapping with an exact URL pattern such as "/foo".
The default implementation of this method simply returns requestViewId unchanged.
deriveViewId in class javax.faces.application.ViewHandlercontext - the FacesContext for this requestinput - the viewId to derive,public String deriveLogicalViewId(javax.faces.context.FacesContext context, String input)
javax.faces.application.ViewHandlerDerive and return the viewId from
the current request, or the argument input by following the
algorithm defined in specification section JSF.7.6.2. Note that
unlike deriveViewId(), this method does not require that
a physical view be present.
This method should work correctly when the
FacesServlet is invoked via either a path mapping,
extension mapping or an exact match (mapping) as
defined by Servlet.12.2. Note that path mapping is also commonly
known as prefix mapping (e.g. "/faces/*") and extension mapping
as suffix mapping (e.g. "*.xhtml"). An exact match is possible
where there's a servlet mapping with an exact URL pattern such as "/foo".
The default implementation of this method simply returns requestViewId unchanged.
deriveLogicalViewId in class javax.faces.application.ViewHandlercontext - the FacesContext for this requestinput - the viewId to derive,public String getRedirectURL(javax.faces.context.FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
javax.faces.application.ViewHandler Return a JSF 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. Compliant implementations
must implement this method as specified in section JSF.7.6.2.
The default implementation simply calls through to ViewHandler.getActionURL(javax.faces.context.FacesContext, java.lang.String), passing the arguments context and
viewId.
getRedirectURL in class javax.faces.application.ViewHandlercontext - The FacesContext processing this requestviewId - The view identifier of the target pageparameters - A mapping of parameter names to one or more valuesincludeViewParams - A flag indicating whether view parameters should be encoded into this URLpublic String getBookmarkableURL(javax.faces.context.FacesContext context, String viewId, Map<String,List<String>> parameters, boolean includeViewParams)
javax.faces.application.ViewHandler Return a JSF action URL derived
from the viewId argument that is suitable to be used as the
target of a link in a JSF response. Compiliant implementations
must implement this method as specified in section JSF.7.6.2.
The default implementation simply calls through to ViewHandler.getActionURL(javax.faces.context.FacesContext, java.lang.String), passing the arguments context and
viewId.
getBookmarkableURL in class javax.faces.application.ViewHandlercontext - The FacesContext processing this requestviewId - The view identifier of the target pageparameters - A mapping of parameter names to one or more valuesincludeViewParams - A flag indicating whether view parameters should be encoded into this URLpublic javax.faces.view.ViewDeclarationLanguage getViewDeclarationLanguage(javax.faces.context.FacesContext context,
String viewId)
javax.faces.application.ViewHandlerReturn
the ViewDeclarationLanguage instance used for this ViewHandler
instance.
The default implementation must use ViewDeclarationLanguageFactory.getViewDeclarationLanguage(java.lang.String)
to obtain the appropriate ViewDeclarationLanguage
implementation for the argument viewId. Any
exceptions thrown as a result of invoking that method must not be
swallowed.
The default implementation of this method returns null.
getViewDeclarationLanguage in class javax.faces.application.ViewHandlercontext - the FacesContext for this request.viewId - the logical view
id, as returned from ViewHandler.deriveLogicalViewId(javax.faces.context.FacesContext, java.lang.String) for which the
ViewDeclarationLanguage should be returned.public void renderView(javax.faces.context.FacesContext context,
javax.faces.component.UIViewRoot viewToRender)
throws IOException,
javax.faces.FacesException
javax.faces.application.ViewHandlerPerform 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 javax.faces.application.ViewHandlercontext - FacesContext for the current requestviewToRender - the view to renderIOException - if an input/output error occursjavax.faces.FacesException - if a servlet error occurspublic javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context,
String viewId)
javax.faces.application.ViewHandlerPerform 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 javax.faces.application.ViewHandlercontext - FacesContext for the current requestviewId - the view identifier for the current requestpublic void writeState(javax.faces.context.FacesContext context)
throws IOException
javax.faces.application.ViewHandlerTake 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 javax.faces.application.ViewHandlercontext - FacesContext for the current requestIOException - if an input/output error occursCopyright © 2010–2018 JBoss by Red Hat. All rights reserved.