Java Reference
In-Depth Information
fancyfoods.food;version="[1.0, 2.0)", javax.naming,
javax.servlet;version="[2.5, 3.0)",
javax.servlet.http;version="[2.5, 3.0)"
Finally, you need to add a new entry into your web.xml to register our servlet:
<servlet>
<servlet-name>SayHelloJNDI</servlet-name>
<servlet-class>fancyfoods.web.SayHelloJNDI</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SayHelloJNDI</servlet-name>
<url-pattern>/SayHelloJNDI</url-pattern>
</servlet-mapping>
Try adding the updated fancyfoods.web to the load directory before the fancy-
foods.api bundle. There's no need to restart the OSG i container; file changes will be
detected and the bundle will be automatically refreshed. When you list the bundles
with ss , fancyfoods.web will only be INSTALLED instead of STARTED . This means some
of its dependencies were missing. When you copy across the fancyfoods.api JAR into
the load directory, the fancyfoods.web bundle will spontaneously leap into life and
become STARTED .
When you load the SayHello JNDI web page, you should see a helpful message
explaining that there are no special offers (figure 2.16 ).
Figure 2.16 Before
the aggregator bundle
is started, the Fancy
Foods welcome page
won't be able to dis-
play any special offers.
After dropping your aggregator into the load directory, a CurrentOffers object will
be available in JNDI , but there won't be any special offers available, so the web page
will show an empty table. Adding the chocolate bundle to the load directory will
cause the chocolate offer to be injected into the offer aggregator (see figure 2.17).
Figure 2.17 After
the aggregator and
chocolate bundle
are loaded, the page
will display a special
offer for chocolate.
Search WWH ::




Custom Search