in impl/src/main/java/org/apache/myfaces/config/impl/FacesConfigDispenserImpl.java [185:347]
public void feed(FacesConfig config)
{
for (Factory factory : config.getFactories())
{
applicationFactories.addAll(factory.getApplicationFactory());
exceptionHandlerFactories.addAll(factory.getExceptionHandlerFactory());
externalContextFactories.addAll(factory.getExternalContextFactory());
facesContextFactories.addAll(factory.getFacesContextFactory());
lifecycleFactories.addAll(factory.getLifecycleFactory());
viewDeclarationLanguageFactories.addAll(factory.getViewDeclarationLanguageFactory());
partialViewContextFactories.addAll(factory.getPartialViewContextFactory());
renderKitFactories.addAll(factory.getRenderkitFactory());
tagHandlerDelegateFactories.addAll(factory.getTagHandlerDelegateFactory());
visitContextFactories.addAll(factory.getVisitContextFactory());
faceletCacheFactories.addAll(factory.getFaceletCacheFactory());
flashFactories.addAll(factory.getFlashFactory());
clientWindowFactories.addAll(factory.getClientWindowFactory());
flowHandlerFactories.addAll(factory.getFlowHandlerFactory());
searchExpressionContextFactories.addAll(factory.getSearchExpressionContextFactory());
facesServletFactories.addAll(factory.getFacesServletFactory());
}
for (Component component : config.getComponents())
{
components.put(component.getComponentType(), component);
}
validators.putAll(config.getValidators());
behaviors.addAll(config.getBehaviors());
for (Application application : config.getApplications())
{
if (!application.getDefaultRenderkitId().isEmpty())
{
defaultRenderKitId =
application.getDefaultRenderkitId().get(application.getDefaultRenderkitId().size() - 1);
}
if (!application.getMessageBundle().isEmpty())
{
messageBundle = application.getMessageBundle().get(application.getMessageBundle().size() - 1);
}
if (!application.getLocaleConfig().isEmpty())
{
localeConfig = application.getLocaleConfig().get(application.getLocaleConfig().size() - 1);
}
actionListeners.addAll(application.getActionListener());
navigationHandlers.addAll(application.getNavigationHandler());
resourceHandlers.addAll(application.getResourceHandler());
viewHandlers.addAll(application.getViewHandler());
stateManagers.addAll(application.getStateManager());
propertyResolver.addAll(application.getPropertyResolver());
variableResolver.addAll(application.getVariableResolver());
resourceBundles.addAll(application.getResourceBundle());
elResolvers.addAll(application.getElResolver());
resourceLibraryContractMappings.addAll(application.getResourceLibraryContractMappings());
searchExpressionHandlers.addAll(application.getSearchExpressionHandler());
searchKeywordResolvers.addAll(application.getSearchKeywordResolver());
// Jsf 2.0 spec section 3.5.3 says this:
// ".... Any configuration resource that declares a list of default
// validators overrides any list provided in a previously processed
// configuration resource. If an empty <default-validators/> element
// is found in a configuration resource, the list
// of default validators must be cleared....."
if (application.isDefaultValidatorsPresent())
{
// we have a <default-validators> element, so any existing
// default validators should be removed
defaultValidatorIds.clear();
// now add all default-validator entries (could be zero)
defaultValidatorIds.addAll(application.getDefaultValidatorIds());
}
else
{
//If isDefaultValidatorsPresent() is false, and there are still
//default validators, it means they were added using annotations, so
//they are not affected by the empty entry according to section 3.5.3
defaultAnnotatedValidatorIds.addAll(application.getDefaultValidatorIds());
}
systemEventListeners.addAll(application.getSystemEventListeners());
}
for (Converter converter : config.getConverters())
{
if (converter.getConverterId() != null)
{
converterById.put(converter.getConverterId(), converter.getConverterClass());
}
if (converter.getForClass() != null)
{
String oldConverter = converterByClass.get(converter.getForClass());
// don't log if someone overwrites the built-in converters
if (oldConverter != null && !oldConverter.startsWith("jakarta.faces.convert."))
{
log.warning("There is already a converter defined for class: " + converter.getForClass() + "."
+ " old: " + oldConverter
+ " new: " + converter.getConverterClass());
}
converterByClass.put(converter.getForClass(), converter.getConverterClass());
}
converterConfigurationByClassName.put(converter.getConverterClass(), converter);
}
for (RenderKit renderKit : config.getRenderKits())
{
String renderKitId = renderKit.getId();
if (renderKitId == null)
{
renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
}
RenderKit existing = renderKits.get(renderKitId);
if (existing == null)
{
existing = new RenderKitImpl();
existing.merge(renderKit);
renderKits.put(renderKitId, existing);
}
else
{
existing.merge(renderKit);
}
}
for (FacesConfigExtension extension : config.getFacesConfigExtensions())
{
for (FaceletsProcessing faceletsProcessing : extension.getFaceletsProcessingList())
{
if (faceletsProcessing.getFileExtension() != null && faceletsProcessing.getFileExtension().length() > 0)
{
faceletsProcessingByFileExtension.put(faceletsProcessing.getFileExtension(), faceletsProcessing);
}
}
}
componentTagDeclarations.addAll(config.getComponentTagDeclarations());
faceletTagLibraries.addAll(config.getFaceletTagLibraryList());
lifecyclePhaseListeners.addAll(config.getLifecyclePhaseListener());
navigationRules.addAll(config.getNavigationRules());
facesVersion = config.getVersion();
namedEvents.addAll(config.getNamedEvents());
facesFlowDefinitions.addAll(config.getFacesFlowDefinitions());
protectedViewUrlPatterns.addAll(config.getProtectedViewsUrlPatternList());
resourceResolvers.addAll(config.getResourceResolversList());
for (FacesConfigExtension extension : config.getFacesConfigExtensions())
{
viewPoolMappings.addAll(extension.getViewPoolMappings());
}
for (FacesConfigExtension extension : config.getFacesConfigExtensions())
{
faceletsTemplateMappings.addAll(extension.getFaceletsTemplateMappings());
}
}