In this chapter we'll develop a very simple JSF based application and deploy it as an OSGi bundle inside of Spring-DM platform
To create a JSF based web bundle follow the same procedure we did in the Chapter 5.
However, you can also import the project into your workspace from samples provided.
Developing and deploying JSF based web bundle inside of OSGi platform should not be any different then any other web bundle. It should not even be different then developing it for standalone container such as Tomcat. Don't forget that the job of Spring-DM web extender only to ". . . trigger the install and uninstall of the WAR - the
actual web application creation and thread management is delegated to
the web container in which the WAR is installed. That is, Spring-DM Web
only dictates when a WAR is deployer to and undeployed from a web container;
it is up to the web container to create and manage the equivalent web application. . ." (Chapter 8.2 of Spring-DM reference manual). Most of the issues arrise from incorrectly assembled Target Platform which triggers varius class loading issues. Fortunately, this tutorial assembles Target Platform (see Chapter 1)which has enough dependancies to satisfy JSF requirements
From OSGi perspective, we'll make our JSF application slightly different then Spring-MVC application we've assembled in the previous chapter. Similar to the previous web application, our web application will import most of the libraries, required to satisfy the class path, from Target Platform (e.g., Import-Package: header in MANIFEST file) it is deployed into. However we will also utilize WEB-INF/lib directory as pre-defined class path location where we'll keep SUN's RI of JSF (jsf-api.jar and jsf-impl.jar).
So here is our MANIFEST.MF file:
Bundle-Name: Sample JSF Bundle
There you see Bundle-Classpath header which points to the two JSF JAR files located in WEB-INF/lib directory, as well as Import-Package header importing other dependencies that are available within the Target Platform.
This is it. Everything else is the same as any other JSF application.
Follow the same deployment and packaging procedure as outlined in the previous chapter.
Once deployed access this http://localhost:8080/jsfsample/testjsf.jsf URL and you should see: