Web application bundles

A web application bundle (WAB) is a bundle that contains a web application and that can be deployed in an OSGi container. A WAB is an OSGi bundle version of a web application archive (WAR) file.

WABs are defined in the OSGi Service Platform Release 4 Version 4.2 Enterprise Specification.

You use a WAB in an OSGi application in much the same way that you use a WAR file in a Java™ enterprise application. For example, you use a WAB to host servlets, static content, or JavaServer Pages (JSPs) that are part of your application.

A WAB contains a manifest file, META-INF/MANIFEST.MF. This file contains the same minimum set of manifest headers that any OSGi bundle manifest contains (for example Bundle-SymbolicName and Bundle-ManifestVersion), and also extra headers that are specific to WABs. You use these headers to describe your web application in OSGi terms, and to specify the support that you want from the OSGi Applications runtime environment. For example, you do not need to package dependencies inside a WAB; you can instead specify these dependencies in a manifest header and let the runtime environment provision them for you. The only required extra header is Web-ContextPath. You use this header to specify the default context from which the web content is hosted.

An OSGi WAB that uses Servlet 3.0 metadata can contain EJBs. If your WAB contains EJBs, and you use a deployment descriptor XML file to define your EJB metadata, then the file must be located at WEB-INF/ejb-jar.xml. Any IBM binding files must be located in the WEB-INF folder; for example, WEB-INF/ibm-ejb-jar-bnd.xml.

You can convert an enterprise application that contains only WAR files to an OSGi application packaged as an enterprise bundle archive (EBA) file. When you import the EBA file as an asset, the WAR files are automatically converted to WABs.