tree: a0c65a9b6736f23ecac67b388de8ed89f31644ff [path history] [tgz]
  1. additional-bundle/
  2. alternate-version-bundle/
  3. functional-test/
  4. lib-bundle/
  5. war-bundle/
  6. pom.xml
  7. README.MD
examples/osgi-helloworld-webapp/README.MD

HelloWorld OSGi Example

This example demonstrates how to develop a simple OSGi WAR bundle containing a RESTful hello world web service

Contents

The example WAR (see the war-bundle module) consists of two Jersey resources:

org.glassfish.jersey.examples.osgi.helloworld.resource.HelloWorldResource

that produces a textual response to an HTTP GET

org.glassfish.jersey.examples.osgi.helloworld.resource.AnotherResource

that produces a different textual response to an HTTP GET. The purpose of this resource is to show how to define multiple web resources within a web application.

The mapping of the URI path space is presented in the following table:

URI pathResource classHTTP method
/helloworldHelloWorldResourceGET
/anotherAnotherResourceGET

Running the Example

To run the example, you would need to build the WAR file and install it to an OSGi runtime (e.g. Apache Felix) together with other OSGi modules. Look at the attached functional-test module for details on the programatical runtime configuration. To build the war archive and run the tests, you can just launch

mvn clean install