Class MyFacesContainerInitializer

  • All Implemented Interfaces:
    jakarta.servlet.ServletContainerInitializer

    public class MyFacesContainerInitializer
    extends Object
    implements jakarta.servlet.ServletContainerInitializer
    This class is called by any Java EE 6 complaint container at startup. It checks if the current webapp is a Faces-webapp by checking if some of the Faces related annotations are specified in the webapp classpath or if the faces-config.xml file is present. If so, the listener checks if the FacesServlet has already been defined in web.xml and if not, it adds the FacesServlet with the mappings (/faces/*, *.jsf, *.faces) dynamically.
    Version:
    $Revision$ $Date$
    Author:
    Jakob Korherr (latest modification by $Author$)
    • Field Detail

      • FACES_SERVLET_ADDED_ATTRIBUTE

        public static final String FACES_SERVLET_ADDED_ATTRIBUTE
        If the servlet mapping for the FacesServlet is added dynamically, Boolean.TRUE is stored under this key in the ServletContext.
        See Also:
        Constant Field Values
      • FACES_SERVLET_FOUND

        public static final String FACES_SERVLET_FOUND
        If the servlet mapping for the FacesServlet is found on the ServletContext, Boolean.TRUE is stored under this key in the ServletContext.
        See Also:
        Constant Field Values
      • FACES_SERVLET_SERVLETREGISTRATION

        public static final String FACES_SERVLET_SERVLETREGISTRATION
        Store the FacesServlet ServletRegistration using this key in the ServletContext. The is necessary for the Faces 4.0 Extensionless Mapping feature. This is used in FacesInitializerImpl when configuring the Extensionless Mapping feature since an UnsupportedOperationException is thrown when calling the ServletContext.getServletRegistrations method if the StartupServletContextListener was added programmatically.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MyFacesContainerInitializer

        public MyFacesContainerInitializer()
    • Method Detail

      • onStartup

        public void onStartup​(Set<Class<?>> clazzes,
                              jakarta.servlet.ServletContext servletContext)
                       throws jakarta.servlet.ServletException
        Specified by:
        onStartup in interface jakarta.servlet.ServletContainerInitializer
        Throws:
        jakarta.servlet.ServletException