Can you have JSF custom components in different OSGi bundles?
Has anyone used OSGi and JSF together?
I ask because JSF uses class-loader magic to find custom components. From a tutorial (emphasis mine):
This configuration file will end up being META-INF/faces-config.xml in the .jar file that represents this component. JSF will look for such a file name in each of the .jar files that are loaded at runtime (in the WEB-INF/lib directory for .war files) and use each of them in its configuration. In this way, multiple component .jar files can be combined into one web application, and all of the components described in each .jar will be available to the application.
I would like to be able to have JSF custom components as OSGi bundles (ie custom components are in different OSGi bundles than the JSF runtime) and for JSF to be able to find these at runtime.
Has anyone done anything similar?
It is possible in the following way:
If you use maven-bundle plugin you must use an apostrophe and an equal for exporting META-INF and sub-packages. For example:
<Export-Package>
a.b.c,
'=META-INF',
'=META-INF.resources',
...
</Export-Package>
In JSF Spec 2.2 there might be parts about JSF-OSGI relationship. To see the progress see http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-942
I am not sure it does exactly answer your problem, but I found this thread about Spring and osgi interresting, especially this specific answer where dependencies and classpath are bundled in the MANIFEST.MF.
That thread also leads to the update of this for tutorial about Spring Dynamic Modules (DM) for OSGi™ Service Platforms which may also be of interest.
链接地址: http://www.djcxy.com/p/12956.html