Stan Silvert [
https://community.jboss.org/people/ssilvert] modified the document:
"Design of AS7 multi-JSF feature"
To view the document, visit:
https://community.jboss.org/docs/DOC-47689
--------------------------------------------------------------
*About multi-JSF*
Currently, AS7 ships with two JSF implementations, a JSF 2.1 implementation and a JSF 1.2
implementation. A web application can select which implementation is used by including a
context param in web.xml. By default, it uses the JSF 2.1 imlementation.
"multi-JSF" allows installation of multiple JSF implementations (and versions)
on the same AS7 server. The goal is to allow use of any JSF implementation (MyFaces or
Mojarra) and any version of those implementation from JSF 1.1 all the way up to the
experimental JSF 2.2 versions. This is far superior to the old WAR_BUNDLES_JSF_IMPL
method because JSF jars do not need to be bundled with the webapp. More importantly,
"multi-JSF" provides an implementation that is fully integrated with the
container. This means more efficient annotation processing, lifecycle handling, and other
integration advantages.
*How it works*
The way multi-JSF will work is that for each JSF version, a new slot is created in the
modules path under *com.sun.jsf-impl*, *javax.faces.api*, and
*org.jboss.as.jsf-injection*. When the jsf-subsystem is started, it scans the module path
to find all the installed JSF implementations. When the JSF subsystem deploys a web app
containing the specified context param, it adds the slotted modules to the deployment.
Here is an example of the context param for the latest milestone of Mojarra 2.2:
<context-param>
<param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
<param-value>mojarra-2.2.0-m05</param-value>
</context-param>
*How a JSF implementation is installed*
A single JSF implementation is installed using a
https://community.jboss.org/docs/DOC-18945 CLI deployment archive. This archive includes
the required jars and module.xml files. It also includes CLI scripts for
installing/uninstalling the JSF impls using the
https://issues.jboss.org/browse/AS7-4265
CLI module command. You execute the installation archive like this:
[standalone@localhost:9999 /] deploy <local path to
archive>/install-mojarra-2.2.0-m05.cli
The install script inside the archive looks like this:
module add --name=javax.faces.api --slot=mojarra-2.2.0-m05
--resources=jsf-api-2.2.0-m05.jar --module-xml=mojarra-api-module.xml
module add --name=com.sun.jsf-impl --slot=mojarra-2.2.0-m05
--resources=jsf-impl-2.2.0-m05.jar --module-xml=mojarra-impl-module.xml
module add --name=org.jboss.as.jsf-injection --slot=mojarra-2.2.0-m05
--resources=jboss-as-jsf-injection-7.2.0.Alpha1-SNAPSHOT.jar
--module-xml=injection-module.xml
*How the CLI deployment archives are created*
A CLI deployment archive for a JSF implementation/version is created using a standalone
maven project. To create an archive with the project, you call it like this:
mvn -Djsf-version=2.2.0-m05 -Pmojarra clean assembly:single
This pulls in the JSF resources and creates the install/uninstall scripts. It is
all bundled together in an archive (zip) file that is renamed with a .cli extension.
My current thinking is that we might not need to release the maven project that creates
the CLI deployment archives. There is a finite number of JSF implementations and
versions. So we could simply create all the possible archives and make them available for
download. I suspect that the total number of these is less than 50. However, the current
implementation relies on a particular version of the jsf-injection module that ships with
AS7. So it really means about 50 archives each time the jsf-injection module changes. I
might be able to eliminate the inclusion of jsf-injection in the future.
*Demo*
I've attached a copy of install-mojarra-2.2.0-m05.cli and install-myfaces-2.1.8.cli.
You can unzip to take a look at it. You can even deploy it with the latest nightly build
of AS7. This will let you see how the modules are installed. I'm not quite done
with updates to the jsf-subsystem, so you can't see multi-jsf in action on a webapp
yet. If you want to try it out though, let me know. I can upload a working version to my
github account.
--------------------------------------------------------------
Comment by going to Community
[
https://community.jboss.org/docs/DOC-47689]
Create a new document in JBoss AS 7 Development at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=102&a...]