|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.omnifaces.facesviews.FacesViews
public final class FacesViews
This class contains the core methods that implement the Faces Views feature. TODO: break up in logic and config?
Field Summary | |
---|---|
static java.lang.String |
FACES_VIEWS_DISPATCH_METHOD_PARAM_NAME
The name of the init parameter (in web.xml) that determines the method used by FacesViews to invoke the FacesServlet. |
static java.lang.String |
FACES_VIEWS_ENABLED_PARAM_NAME
Web context parameter to switch auto-scanning completely off for Servlet 3.0 containers. |
static java.lang.String |
FACES_VIEWS_EXTENSION_ACTION_PARAM_NAME
The name of the init parameter (in web.xml) that determines the action that is performed whenever a resource is requested WITH extension that's also available without an extension. |
static java.lang.String |
FACES_VIEWS_FILTER_AFTER_DECLARED_FILTERS_PARAM_NAME
The name of the boolean init parameter (in web.xml) via which the user can set whether the FacesViewsForwardingFilter
should match before declared filters (false) or after declared filters (true); |
static java.lang.String |
FACES_VIEWS_ORIGINAL_SERVLET_PATH
|
static java.lang.String |
FACES_VIEWS_PATH_ACTION_PARAM_NAME
The name of the init parameter (in web.xml) that determines the action that is performed whenever a resource is requested in a public path that has been used for scanning views by faces views. |
static java.lang.String |
FACES_VIEWS_RESOURCES
|
static java.lang.String |
FACES_VIEWS_RESOURCES_EXTENSIONS
|
static java.lang.String |
FACES_VIEWS_REVERSE_RESOURCES
|
static java.lang.String |
FACES_VIEWS_SCAN_PATHS_PARAM_NAME
The name of the init parameter (in web.xml) where the value holds a comma separated list of paths that are to be scanned by faces views. |
static java.lang.String |
FACES_VIEWS_SCANNED_VIEWS_EXTENSIONLESS_PARAM_NAME
The name of the init parameter (in web.xml) via which the user can set scanned views to be always rendered extensionless. |
static java.lang.String |
PUBLIC_SCAN_PATHS
The name of the application scope context parameter under which a Set version of the public paths that are to be scanned by faces views are kept. |
static java.lang.String |
SCAN_PATHS
The name of the application scope context parameter under which a Set version of the paths that are to be scanned by faces views are kept. |
static java.lang.String |
SCANNED_VIEWS_EXTENSIONLESS
The name of the application scope context parameter under which a Boolean version of the scanned views always exensionless init parameter is kept. |
static java.lang.String |
WEB_INF_VIEWS
A special dedicated "well-known" directory where facelets implementing views can be placed. |
Method Summary | |
---|---|
static boolean |
canScanDirectory(java.lang.String rootPath,
java.lang.String directory)
|
static boolean |
canScanResource(java.lang.String resource,
java.lang.String extensionToScan)
|
static ExtensionAction |
getExtensionAction(javax.servlet.ServletContext servletContext)
|
static java.lang.String |
getExtensionlessURLWithQuery(javax.servlet.http.HttpServletRequest request)
Obtains the full request URL from the given request complete with the query string, but with the extension (if any) cut out. |
static java.lang.String |
getExtensionlessURLWithQuery(javax.servlet.http.HttpServletRequest request,
java.lang.String resource)
Obtains the full request URL from the given request and the given resource complete with the query string, but with the extension (if any) cut out. |
static FacesServletDispatchMethod |
getFacesServletDispatchMethod(javax.servlet.ServletContext servletContext)
|
static java.lang.String |
getMappedPath(java.lang.String path)
|
static PathAction |
getPathAction(javax.servlet.ServletContext servletContext)
|
static java.util.Set<java.lang.String> |
getPublicRootPaths(javax.servlet.ServletContext servletContext)
|
static java.util.Set<java.lang.String> |
getRootPaths(javax.servlet.ServletContext servletContext)
|
static boolean |
isFilterAfterDeclaredFilters(javax.servlet.ServletContext servletContext)
|
static boolean |
isResourceInPublicPath(javax.servlet.ServletContext servletContext,
java.lang.String resource)
|
static java.lang.Boolean |
isScannedViewsAlwaysExtensionless(javax.faces.context.FacesContext context)
|
static void |
mapFacesServlet(javax.servlet.ServletContext servletContext,
java.util.Set<java.lang.String> extensions)
Map the Facelets Servlet to the given extensions |
static java.lang.String |
normalizeRootPath(java.lang.String rootPath)
|
static java.util.Map<java.lang.String,java.lang.String> |
scanAndStoreViews(javax.servlet.ServletContext context)
Scans for faces-views resources and stores the result at the designated location "org.omnifaces.facesviews" in the ServletContext. |
static java.util.Map<java.lang.String,java.lang.String> |
scanViews(javax.servlet.ServletContext servletContext)
Scans resources (views) recursively starting with the given resource paths and returns a flat map containing all resources encountered. |
static void |
scanViews(javax.servlet.ServletContext servletContext,
java.lang.String rootPath,
java.util.Set<java.lang.String> resourcePaths,
java.util.Map<java.lang.String,java.lang.String> collectedViews,
java.lang.String extensionToScan,
java.util.Set<java.lang.String> collectedExtensions)
Scans resources (views) recursively starting with the given resource paths for a specific root path, and collects those and all unique extensions encountered in a flat map respectively set. |
static void |
scanViewsFromRootPaths(javax.servlet.ServletContext servletContext,
java.util.Map<java.lang.String,java.lang.String> collectedViews,
java.util.Set<java.lang.String> collectedExtensions)
|
static java.lang.String |
stripFacesViewsPrefix(java.lang.String resource)
Strips the special 'faces-views' prefix path from the resource if any. |
static void |
tryScanAndStoreViews(javax.servlet.ServletContext context)
Checks if resources haven't been scanned yet, and if not does scanning and stores the result at the designated location "org.omnifaces.facesviews" in the ServletContext. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String WEB_INF_VIEWS
public static final java.lang.String FACES_VIEWS_ENABLED_PARAM_NAME
public static final java.lang.String FACES_VIEWS_SCAN_PATHS_PARAM_NAME
public static final java.lang.String FACES_VIEWS_SCANNED_VIEWS_EXTENSIONLESS_PARAM_NAME
public static final java.lang.String FACES_VIEWS_EXTENSION_ACTION_PARAM_NAME
ExtensionAction
public static final java.lang.String FACES_VIEWS_PATH_ACTION_PARAM_NAME
PathAction
public static final java.lang.String FACES_VIEWS_DISPATCH_METHOD_PARAM_NAME
FacesServletDispatchMethod
.
public static final java.lang.String FACES_VIEWS_FILTER_AFTER_DECLARED_FILTERS_PARAM_NAME
FacesViewsForwardingFilter
should match before declared filters (false) or after declared filters (true);
public static final java.lang.String SCAN_PATHS
public static final java.lang.String PUBLIC_SCAN_PATHS
public static final java.lang.String SCANNED_VIEWS_EXTENSIONLESS
public static final java.lang.String FACES_VIEWS_RESOURCES
public static final java.lang.String FACES_VIEWS_REVERSE_RESOURCES
public static final java.lang.String FACES_VIEWS_RESOURCES_EXTENSIONS
public static final java.lang.String FACES_VIEWS_ORIGINAL_SERVLET_PATH
Method Detail |
---|
public static void scanViewsFromRootPaths(javax.servlet.ServletContext servletContext, java.util.Map<java.lang.String,java.lang.String> collectedViews, java.util.Set<java.lang.String> collectedExtensions)
public static java.util.Set<java.lang.String> getRootPaths(javax.servlet.ServletContext servletContext)
public static java.util.Set<java.lang.String> getPublicRootPaths(javax.servlet.ServletContext servletContext)
public static java.lang.String normalizeRootPath(java.lang.String rootPath)
public static boolean isResourceInPublicPath(javax.servlet.ServletContext servletContext, java.lang.String resource)
public static ExtensionAction getExtensionAction(javax.servlet.ServletContext servletContext)
public static PathAction getPathAction(javax.servlet.ServletContext servletContext)
public static FacesServletDispatchMethod getFacesServletDispatchMethod(javax.servlet.ServletContext servletContext)
public static boolean isFilterAfterDeclaredFilters(javax.servlet.ServletContext servletContext)
public static java.lang.Boolean isScannedViewsAlwaysExtensionless(javax.faces.context.FacesContext context)
public static void scanViews(javax.servlet.ServletContext servletContext, java.lang.String rootPath, java.util.Set<java.lang.String> resourcePaths, java.util.Map<java.lang.String,java.lang.String> collectedViews, java.lang.String extensionToScan, java.util.Set<java.lang.String> collectedExtensions)
servletContext
- rootPath
- one of the paths from which views are scanned. By default this is typically /WEB-INF/faces-view/resourcePaths
- collection of paths to be considered for scanning, can be either files or directories.collectedViews
- a mapping of all views encountered during scanning. Mapping will be from the simplified form to the
actual location relatively to the web root. E.g key "foo", value "/WEB-INF/faces-view/foo.xhtml"extensionToScan
- a specific extension to scan for. Should start with a ., e.g. ".xhtml". If this is given, only
resources with that extension will be scanned. If null, all resources will be scanned.collectedExtensions
- set in which all unique extensions will be collected. May be null, in which case no extensions will be
collectedpublic static boolean canScanDirectory(java.lang.String rootPath, java.lang.String directory)
public static boolean canScanResource(java.lang.String resource, java.lang.String extensionToScan)
public static java.util.Map<java.lang.String,java.lang.String> scanViews(javax.servlet.ServletContext servletContext)
servletContext
-
public static void tryScanAndStoreViews(javax.servlet.ServletContext context)
context
- public static java.util.Map<java.lang.String,java.lang.String> scanAndStoreViews(javax.servlet.ServletContext context)
context
-
public static java.lang.String stripFacesViewsPrefix(java.lang.String resource)
resource
-
public static java.lang.String getMappedPath(java.lang.String path)
public static void mapFacesServlet(javax.servlet.ServletContext servletContext, java.util.Set<java.lang.String> extensions)
extensions
- collections of extensions (typically those as encountered during scanning)public static java.lang.String getExtensionlessURLWithQuery(javax.servlet.http.HttpServletRequest request)
E.g. http://localhost/foo/bar.xhtml?kaz=1
becomes http://localhost/foo/bar?kaz=1
request
- the request from the URL is obtained.
public static java.lang.String getExtensionlessURLWithQuery(javax.servlet.http.HttpServletRequest request, java.lang.String resource)
E.g. http://localhost/foo/bar.xhtml?kaz=1
becomes http://localhost/foo/bar?kaz=1
request
- the request from which the base URL is obtained.resource
- the resource relative to the base URL
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |