HelloWorldWebApp Example

This example demonstrates how to develop RESTful hello world web service with a Servlet 3.0 container, if you are working with Jersey GlassFish update center module installed into your existing GlassFish instance. Otherwise, with a Servlet 2.5 container.

Contents

The example consists of just one Java class:

com.sun.jersey.samples.helloworld.resources.HelloWorldResource
A resource class that produces a textual response to an HTTP GET.

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

URI path Resource class HTTP methods
/helloworld HelloWorldResource GET

Running the Example

If you are working with Jersey GlassFish update center module installed into your existing GlassFish instance, you will need to follow instructions at the module README file in order to deploy the example.

Otherwise, you can run the example using embedded GlassFish as follows:

run

mvn clean package embedded-glassfish:run

or you can run the example using Jetty as follows:

mvn clean package jetty:run

From a web browser, visit:

http://localhost:8080/helloworld-webapp/helloworld