This example demonstrates how to develop a simple OSGi WAR bundle containing a RESTful hello world web service
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 path | Resource class | HTTP method |
---|---|---|
/helloworld | HelloWorldResource | GET |
/another | AnotherResource | GET |
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