MyFaces core provides some "points of integration" that can be used by application and web servers to override or add some specific code. For example, JBoss AS provides a custom virtual file system (VFS), and MyFaces core needs to scan for faces-config.xml files, so it is necessary to provide some code that uses JBoss VFS to locate faces-config.xml files to be parsed later.
Note usually common users of MyFaces Core does not need to deal with these specific stuff, because the application/web server could already provide the necessary hooks or integration modules "out of the box".
Some features uses Service Provider Interface (SPI) pattern, so take a look at java.util.ServiceLoader description in java 6 api to get the idea how it works.
Below there is a table of the "points of integration" used by application and web servers:
Integration Point |
Classes Involved |
Description |
Since |
SPI |
---|---|---|---|---|
@PostConstruct and @PreDestroy injection over jsf managed beans |
org.apache.myfaces.config.annotation.LifecycleProvider2 |
Provide methods to delegate injection of @PostConstruct and
@PreDestroy annotations to the server for custom processing. |
1.2.7 |
Yes |
Override SPI handling |
org.apache.myfaces.spi.ServiceProviderFinder |
Override SPI handling done by MyFaces Core, usually taking
advantage of container specific features to scan files inside jars. |
2.0.3, 2.1.0 |
No |
Annotation Scanning |
org.apache.myfaces.spi.AnnotationProvider |
Override/wrap myfaces annotation scanning algorithm that needs to be processed at startup. |
2.0.3, 2.1.0 |
Yes |
Locate facelet .taglib.xml files through classpath. |
org.apache.myfaces.spi.FaceletConfigResourceProvider |
Locate facelet .taglib.xml files through classpath. These files has definitions that are used by facelets algorithm to parse view files. |
2.0.3, 2.1.0 |
Yes |
Locate faces-config.xml files through classpath. |
org.apache.myfaces.spi.FacesConfigResourceProvider |
Locate faces-config xml files through classpath. These files has definitions that are used by initialize jsf environment. By default it locate all files inside META-INF folder, named faces-config.xml or ending with .faces-config.xml |
2.0.3, 2.1.0 |
Yes |
Get an unified configuration after sort and order all config
files. |
org.apache.myfaces.spi.FacesConfigurationMerger |
Get all org.apache.myfaces.config.element.FacesConfig data and then it combines it into one org.apache.myfaces.config.element.FacesConfigData instance. |
2.0.3, 2.1.0 |
Yes |
Get configuration information from different sources and allow
cache them. |
org.apache.myfaces.spi.FacesConfigurationProvider |
This interface provide a way to merge and store all JSF config information retrieved from faces-config.xml files, META-INF/service files and annotations that works as base point to initialize MyFaces. The objective is allow server containers to "store" or this information, preventing calculate it over and over each time the web application is started. |
2.0.3, 2.1.0 |
Yes |
Override javax.faces.FactoryFinder default algorithm |
org.apache.myfaces.spi.FactoryFinderProvider |
Provide an interface to override javax.faces.FactoryFinder class
methods. This is useful if containers does not want to use Thread Context
Class Loader to load classes, like in OSGi. |
2.0.5, 2.1.0 |
Yes |
Provide additional info from web.xml files |
org.apache.myfaces.spi.WebConfigProvider |
Provide additional info from web.xml files, like mapping or if an
error page is present. |
2.0.3, 2.1.0 |
Yes |
Override initialization and destroy web applications |
org.apache.myfaces.webapp.FacesInitializer |
Allow customize initialization / destroy operations or provide an
alternate MyFaces initializer to a specific container. |
2.0.1, |
No |
Indicate the servlet can be considered a FacesServlet. |
org.apache.myfaces.shared_impl.webapp.webxml.DelegatedFacesServlet |
Indicate the servlet can be considered a FacesServlet. |
1.1.7, 1.2.3, 2.0.0, |
No |
Scan for annotated Flows and manage Flow scope |
org.apache.myfaces.spi.FacesFlowProvider |
In this interface @FlowDefinition annotation is scanned for flows defined programatically and it is also managed the flow scope logic. By default MyFaces provides two implementations, one using CDI and one without CDI (that only manages flow scope) |
2.2.0 |
Yes |
Manage View scope |
org.apache.myfaces.spi.ViewScopeProvider |
This interface manage the logic to plug the view scope with JSF. It has some methods to handle view scope destroy or session destroy |
2.2.0 |
Yes |
Scan for available contracts |
org.apache.myfaces.spi.ResourceLibraryContractsProvider |
Provides an interface to scan for the available resource library contracts in the current environment. By default it scans using external context getResource(...) methods and in the classpath according to JSF spec. |
2.2.0 |
Yes |
For more detailed information, take a look at the javadoc of each class on myfaces site.