OPS4J Pax Web ahead of its time?
This days OSGi Alliance released the OSGi 4.2 Public Drafts. The Draft 3 contains an RFC66 named “OSGi and Web Applications” which will probably make it into a WebContainer service in the upcoming 4.2 release. The scope of this RFC is to align OSGi specs related to web development with the latest specs fo Java Servlets and Java Server Pages (JSP), which is in my opinion an excellent move pushed forward by the OSGi EEG (original specs started 5 years ago?).
So far so good, but where is the connection to OPS4J Pax Web? Well, the specs is almost like the specs for Pax Web + Pax Web Extender WAR + “war:” URL Handler + latest changes from Servlet Specs 2.5 (annotations). If you never heard about this Pax projects, here is a short description:
Pax Web is at it basics an OSGi HTTP Service implementation based on Jetty 6. But envisioning the need for other, common, web elements, Pax Web provides support for using filters, listeners, error pages, welcome files and JSP. No similar support was available and guess what? This is what WebContainer is all about.
Having this support, next step was to help people that had of want to deploy a standard WAR file into OSGi. And all of this without any prior knowledge of HTTP Service. That is Pax Web Extender WAR about: act as an extender by watching starting bundles. If the bundle was a WAR, meaning that it contains a file “WEB-INF/web.xml”, the WAR bundle’s configuration (web.xml) was transformed in calls to Pax Web. The result? You could easy deploy a WAR. You already guessed? You will find this in the WebContainer specs.
Pax Web Extender was helping but in order to have a standard, non OSGi WAR file, compatible with OSGi it needed to have the usual OSGi manifest headers for to Import-Packages and the Bundle-ClassPath to point to those jars inside the “lib” directory. You could do that by hand, at build time, before deploying such a WAR or you could use the “war:” URL handler. This url handler was doing all this transformation automatically for you, by taking a WAR file calculating on the fly the necessary imports and bundle classpath. So, while within an OSGi framework that had the protocol handler installed you could simple install a “standard” WAR without any other change by using an url like “war:“. And yes, also this is this is in the WebContainer specs.
So, was Pax Web and friends ahead of its time? I would say, yes it was. And still is
4 Comments
Jump to comment form | comment rss [?] | trackback uri [?]