docs: public void initFaces(ServletContext servletContext)
      {
          try
          {
              if (log.isLoggable(Level.FINEST))
              {
                  log.finest("Initializing MyFaces");
              }
  
              // Some parts of the following configuration tasks have been implemented 
              // by using an ExternalContext. However, that's no problem as long as no 
              // one tries to call methods depending on either the ServletRequest or 
              // the ServletResponse.
              // JSF 2.0: FacesInitializer now has some new methods to
              // use proper startup FacesContext and ExternalContext instances.
              FacesContext facesContext = FacesContext.getCurrentInstance();
              ExternalContext externalContext = facesContext.getExternalContext();
  
              // Setup ServiceProviderFinder
              ServiceProviderFinder spf = ServiceProviderFinderFactory.getServiceProviderFinder(
                  externalContext);
              Map<String, List<String>> spfConfig = spf.calculateKnownServiceProviderMapInfo(
                  externalContext, ServiceProviderFinder.KNOWN_SERVICES);
              if (spfConfig != null)
              {
                  spf.initKnownServiceProviderMapInfo(externalContext, spfConfig);
              }
                          
              // Parse and validate the web.xml configuration file
              
              if (!WebConfigParamUtils.getBooleanInitParameter(externalContext, INITIALIZE_ALWAYS_STANDALONE, false))
              {
                  WebConfigProvider webConfigProvider = WebConfigProviderFactory.getWebConfigProviderFactory(
                          facesContext.getExternalContext()).getWebConfigProvider(facesContext.getExternalContext());
  
                  if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty())
                  {
                      // check to see if the FacesServlet was found by MyFacesContainerInitializer
                      Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_FOUND);
  
                      if (mappingAdded == null || !mappingAdded)
                      {
                          // check if the FacesServlet has been added dynamically
                          // in a Servlet 3.0 environment by MyFacesContainerInitializer
                          mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);
  
                          if (mappingAdded == null || !mappingAdded)
                          {
                              if (log.isLoggable(Level.WARNING))
                              {
                                  log.warning("No mappings of FacesServlet found. Abort initializing MyFaces.");
                              }
                              return;
                          }
                      }
                  }
              }
  
              initCDIIntegration(servletContext, externalContext);
              
              initContainerIntegration(servletContext, externalContext);
              
              ViewScopeProviderFactory factory = ViewScopeProviderFactory.getViewScopeHandlerFactory(
                  externalContext);
              
              ViewScopeProvider viewScopeHandler = factory.getViewScopeHandler(
                  externalContext);
              
              ManagedBeanDestroyerListener listener = (ManagedBeanDestroyerListener)
                  externalContext.getApplicationMap().get(
                      ManagedBeanDestroyerListener.APPLICATION_MAP_KEY);
              
              listener.setViewScopeHandler(viewScopeHandler);
  
              String useEncryption = servletContext.getInitParameter(StateUtils.USE_ENCRYPTION);
              if (!"false".equals(useEncryption)) // the default value is true
              {
                  StateUtils.initSecret(servletContext);
              }
  
              // initialize eager managed beans
              _createEagerBeans(facesContext);
  
              _dispatchApplicationEvent(servletContext, PostConstructApplicationEvent.class);
  
              if ( (facesContext.isProjectStage(ProjectStage.Development) || 
                    facesContext.isProjectStage(ProjectStage.Production)) &&
                   log.isLoggable(Level.INFO))
              {
                  log.info("ServletContext initialized.");
              }
  
              WebConfigParamsLogger.logWebContextParams(facesContext);
              
              //Force output EL message
              ExternalSpecifications.isUnifiedELAvailable();
              ExternalSpecifications.isBeanValidationAvailable();
              
              //Start ViewPoolProcessor if necessary
              ViewPoolProcessor.initialize(facesContext);
  
              // print out a very prominent log message if the project stage is != Production
              if (!facesContext.isProjectStage(ProjectStage.Production) &&
                  !facesContext.isProjectStage(ProjectStage.UnitTest))
              {
                  ProjectStage projectStage = facesContext.getApplication().getProjectStage();
                  StringBuilder message = new StringBuilder("\n\n");
                  message.append("*******************************************************************\n");
                  message.append("*** WARNING: Apache MyFaces-2 is running in ");
                  message.append(projectStage.name().toUpperCase());        
                  message.append(" mode.");
                  int length = projectStage.name().length();
                  for (int i = 0; i < 11 - length; i++)
                  {
                      message.append(" ");
                  }
                  message.append("   ***\n");
                  message.append("***                                         ");
                  for (int i = 0; i < length; i++)
                  {
                      message.append("^");
                  }
                  for (int i = 0; i < 20 - length; i++)
                  {
                      message.append(" ");
                  }
                  message.append("***\n");
                  message.append("*** Do NOT deploy to your live server(s) without changing this. ***\n");
                  message.append("*** See Application#getProjectStage() for more information.     ***\n");
                  message.append("*******************************************************************\n");
                  log.log(Level.WARNING, message.toString());
              }
  
          }
          catch (Exception ex)
          {
              log.log(Level.SEVERE, "An error occured while initializing MyFaces: "
                        + ex.getMessage(), ex);
          }
      }