{
// get the FacesConfigProvider SPI impl in order to get the faces-config data for the merging process
FacesConfigurationProvider facesConfigProvider = FacesConfigurationProviderFactory
.getFacesConfigurationProviderFactory(externalContext).getFacesConfigurationProvider(externalContext);
FacesConfigDispenser dispenser = new DigesterFacesConfigDispenserImpl();
// standard-faces-config.xml
dispenser.feed(facesConfigProvider.getStandardFacesConfig(externalContext));
// META-INF/services/[factory name] factory definitions
dispenser.feed(facesConfigProvider.getMetaInfServicesFacesConfig(externalContext));
// WEB-INF/faces-config.xml
FacesConfig webAppFacesConfig = facesConfigProvider.getWebAppFacesConfig(externalContext);
//read metadata-complete attribute on WEB-INF/faces-config.xml
boolean metadataComplete = false;
if(webAppFacesConfig != null)
{
metadataComplete = Boolean.valueOf(webAppFacesConfig.getMetadataComplete());
}
else
{
//assume false if no faces-config.xml was found
//metadata-complete can only be specified in faces-config.xml per the JSF 2.0 schema
metadataComplete = false;
}
// faces-config data from Annotations
FacesConfig annotationFacesConfig = facesConfigProvider
.getAnnotationsFacesConfig(externalContext, metadataComplete);
if (annotationFacesConfig != null)
{
dispenser.feed(annotationFacesConfig);
}
List<FacesConfig> appConfigResources = new ArrayList<FacesConfig>();
// META-INF/faces-config.xml files