Can you have custom JSF components in different OSGi packages?

Has anyone used OSGi and JSF together?

I ask because JSF uses the magic of the loader class to search for custom components. From the textbook (focus):

This configuration file will be being META-INF / faces-config.xml in the .jar that this component represents. JSF will look for such a file name in each .jar file that is loaded at runtime (in WEB-INF / lib for .war files) and use each of them in its own configuration. Thus, multiple .jar files can be combined into one web application, and all the components described in each .jar will be available for the application.

I would like to have custom JSF components in the form of OSGi packages (i.e. custom components are in different OSGi packages than in the JSF runtime), and for JSF you can find them at runtime.

Has anyone done something like this?

+2
source share
2 answers

This can be done as follows:

  • Your osgi web package should have a “Require-Bundle” in MANIFEST.MF, pointing to a package containing components
  • Your component bank should have an Export-Package containing META-INF and META-INF subpackages where there is any JSF file (and, of course, standard component packages). For example: Export-Package: META-INF, META-INF.resources ...

maven-bundle, META-INF . :

<Export-Package>
  a.b.c,
  '=META-INF',
  '=META-INF.resources',
  ...
</Export-Package>

JSF Spec 2.2 JSF-OSGI. , . http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-942

+1

, , Spring osgi interresting, , MANIFEST.MF.

Spring (DM) OSGi ™ , .

+1

Source: https://habr.com/ru/post/1730034/


All Articles