Java Reference
In-Depth Information
options in chapter 13. In the meantime, the sandbox is a good environment for play-
ing with various bits of enterprise OSG i. We'll start with the public face of almost any
enterprise application, the web frontend.
Writing an OSGi web application
In Java EE the servlet and JavaServer Pages models have provided the basic building
blocks for Java web applications for many years. OSG i web applications are a standard-
ized OSG i version of Java EE web applications. An OSG i web bundle is similar to a Java
EE WAR , except that it also gets the benefits of operating in an OSG i framework. Enter-
prise OSG i web bundles are known as WAB s. (In contrast to WAR s, which are Web
Archives , WAB s are Web Application Bundles .)
Building a simple OSGi web application bundle
Let's give WAB s a try. You can use your favorite OSG i or Java EE development tools. All
you need for now is the ability to compile Java code and build JAR s. (We'll cover spe-
cialist enterprise OSG i development tools in chapter 8. Feel free to peek ahead now if
you're struggling to make OSG i JAR s.)
The simplest WAB contains three files. These are a Java servlet class, a JAR manifest,
and a web deployment descriptor. Figure 2.4 shows how they're laid out in the WAB .
Like WAR s, WAB s are a special kind of JAR . Unlike WAR s, the enterprise OSG i specifica-
tion doesn't require a particular file extension. As a result, WAB files may have any
Figure 2.4 The layout of the fancyfoods.web JAR. All code lives in WEB-INF/classes. The
web container looks at WEB-INF/web.xml to find out what servlets are provided by the bundle.
Finally, the standard JAR manifest, META-INF/MANIFEST.MF includes important extra metadata
for the OSGi container.
Search WWH ::

Custom Search