Class Platform

java.lang.Object
org.omnifaces.util.Platform

public final class Platform extends Object
This class provides access to Jakarta 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 Jakarta general way to obtain platform services.

For a full list of utility methods, check the method summary.

Since:
1.6
Author:
Arjan Tijms
  • Method Details

    • getFacesServletRegistration

      public static ServletRegistration getFacesServletRegistration(ServletContext servletContext)
      Returns the ServletRegistration associated with the FacesServlet.
      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 the FacesServlet.
      Parameters:
      servletContext - The context to get the FacesServlet 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 over getFacesServletMappings(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 in ApplicationInitializer and cached in the ServletContext.
      Returns:
      The default faces servlet mapping (without the wildcard).
      Since:
      3.10