OSGi Support

OSGi Support

Goals

Pax Shiro primarily addresses traditional Java EE (web) applications, but also aims at supporting OSGi enterprise applications (also known as hybrid applications, i.e. OSGi-based and using certain Java EE APIs in an OSGi-compliant manner).

Pax Shiro artifacts and the underlying Apache Shiro artifacts are all packaged as OSGi bundles.

Pax Shiro Facelet Tags in OSGi Web Applications

pax-shiro-faces will work in any OSGi web container if the required Pax Shiro and Apache Shiro libraries are all included in the web application bundle. However, from the OSGi perspective, this scenario is rather trivial - to achieve better modularity, the web application bundle, the required Apache or Pax Shiro libraries and the selected JSF implementation should all be provisioned as separate bundles.

While JSF 2.1 and higher supports modular web applications by letting users package tag libraries, views and static resources in reusable JARs, there is currently no official specification for multi-module JSF applications in OSGi. In particular, the following JSF 2.1 or Servlet 3.0 features are not trivially compatible with OSGi classloader requirements:

  • Discovery of META-INF/faces-config.xml of tag library bundles.

  • Discovery of META-INF/*.taglib.xml of taglib bundles.

  • Loading static resources from META-INF/resources/ of the taglib bundle.

 

Neither Pax Web 3.0 nor Jetty 9 (on top of Equinox) does support all of these features out of the box.

sample-jetty-osgi-boot-jsf is a fragment extending the org.eclipse.jetty.osgi.boot bundle to discover tag libraries from other bundles. (See the Jetty9FacesBundleTest integration test for more details.)

This fragment only depends on Jetty but not on Shiro.