Package org.omnifaces.util
Class Platform
- java.lang.Object
-
- org.omnifaces.util.Platform
-
public final class Platform extends Object
This class provides access to (Java EE 6) platform services from the view point of Faces.Note that this utility class can only be used in a Faces environment and is thus not a Java EE general way to obtain platform services.
- Since:
- 1.6
- Author:
- Arjan Tijms
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getDefaultFacesServletMapping(ServletContext servletContext)
Determines and returns the default faces servlet mapping.static Collection<String>
getFacesServletMappings(ServletContext servletContext)
Returns the mappings associated with theFacesServlet
.static ServletRegistration
getFacesServletRegistration(ServletContext servletContext)
Returns theServletRegistration
associated with theFacesServlet
.
-
-
-
Method Detail
-
getFacesServletRegistration
public static ServletRegistration getFacesServletRegistration(ServletContext servletContext)
Returns theServletRegistration
associated with theFacesServlet
.- Parameters:
servletContext
- The context to get the ServletRegistration from.- Returns:
- ServletRegistration for FacesServlet, or
null
if the FacesServlet is not installed. - Since:
- 1.8
-
getFacesServletMappings
public static Collection<String> getFacesServletMappings(ServletContext servletContext)
Returns the mappings associated with theFacesServlet
.- Parameters:
servletContext
- The context to get theFacesServlet
from.- Returns:
- The mappings associated with the
FacesServlet
, or an empty set. - Since:
- 2.5
-
getDefaultFacesServletMapping
public static String getDefaultFacesServletMapping(ServletContext servletContext)
Determines and returns the default faces servlet mapping. This will loop overgetFacesServletMappings(ServletContext)
and pick the first one starting with*.
or ending with/*
. If Faces is prefix mapped (e.g./faces/*
), then this returns the whole path, with a leading slash (e.g./faces
). If Faces is suffix mapped (e.g.*.xhtml
), then this returns the whole extension (e.g..xhtml
). If none is found, then this falls back to.xhtml
. This is for the first time determined inApplicationInitializer
and cached in theServletContext
.- Returns:
- The default faces servlet mapping (without the wildcard).
- Since:
- 3.10
-
-