// 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))