public class ViewIdSupport extends Object
Modifier | Constructor and Description |
---|---|
protected |
ViewIdSupport(FacesContext facesContext) |
Modifier and Type | Method and Description |
---|---|
String |
calculateActionURL(FacesContext context,
String viewId)
Return a string containing a webapp-relative URL that the user can invoke
to render the specified view.
|
String |
calculateViewId(FacesContext facesContext)
Calculates the view id from the given faces context by the following algorithm
|
String |
deriveLogicalViewId(FacesContext context,
String rawViewId) |
String |
deriveViewId(FacesContext context,
String viewId) |
protected String |
deriveViewId(FacesContext context,
String rawViewId,
boolean checkViewExists) |
static ViewIdSupport |
getInstance(FacesContext facesContext) |
protected String |
handlePrefixMapping(String viewId,
String prefix)
Return the normalized viewId according to the algorithm specified in 7.5.2
by stripping off any number of occurrences of the prefix mapping from the viewId.
|
protected String |
handleSuffixMapping(FacesContext context,
String requestViewId)
Return the viewId with any non-standard suffix stripped off and replaced with
the default suffix configured for the specified context.
|
boolean |
isViewExistent(FacesContext facesContext,
String viewId)
Check if a view exists
|
boolean |
isViewProtected(FacesContext context,
String viewId) |
protected ViewIdSupport(FacesContext facesContext)
public static ViewIdSupport getInstance(FacesContext facesContext)
public String deriveLogicalViewId(FacesContext context, String rawViewId)
public String deriveViewId(FacesContext context, String viewId)
protected String deriveViewId(FacesContext context, String rawViewId, boolean checkViewExists)
public String calculateActionURL(FacesContext context, String viewId)
URLs and ViewIds are not quite the same; for example a url of "/foo.jsf" or "/faces/foo.jsp" may be needed to access the view "/foo.jsp".
protected String handlePrefixMapping(String viewId, String prefix)
For example, both /faces/view.xhtml and /faces/faces/faces/view.xhtml would both return view.xhtml
protected String handleSuffixMapping(FacesContext context, String requestViewId)
For example, an input parameter of "/foo.jsf" may return "/foo.jsp".
public boolean isViewExistent(FacesContext facesContext, String viewId)
facesContext
- viewId
- public String calculateViewId(FacesContext facesContext)
Calculates the view id from the given faces context by the following algorithm
ExternalContext.getRequestPathInfo()
ExternalContext.getRequestServletPath()
FacesException
public boolean isViewProtected(FacesContext context, String viewId)
Copyright © 2022 The Apache Software Foundation. All rights reserved.