code: @Override
      public FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle) throws FacesException {
          FacesContext result = null;
          if (null != initContextServletContextMap && !initContextServletContextMap.isEmpty()) {
              ServletContext servletContext = (ServletContext) FactoryFinder.FACTORIES_CACHE.getServletContextForCurrentClassLoader();
              if (null != servletContext) {
                  for (Map.Entry<FacesContext, ServletContext> entry : initContextServletContextMap.entrySet()) {
                      if (servletContext.equals(entry.getValue())) {
                          result = entry.getKey();
                          break;
                      }
                  }
              }
          }
              
          return result;
      }
docs: /*
  Consult the initContextServletContextMap (reflectively obtained from
  the FacesContext in our ctor).  If it is non-empty, obtain
  the ServletContext corresponding to the current Thread's context ClassLoader.
  If found, use the initContextServletContextMap to find the FacesContext
  corresponding to that ServletContext.