Jersey EJB Example

This example demonstrates how to develop RESTful web service with a Servlet 2.5 container.

Contents

TODO

TODO
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 method Description
/jersey-ejb --- GET Simple html/ajax client
/jersey-ejb/app/messages MessageBoardResourceBean GET Returns first ten messsages
/jersey-ejb/app/messages/{id} MessageBoardResourceBean GET Returns message with uniqueId = {id} or returns HTTP 404 if message does not exist
/jersey-ejb/app/messages/{id} MessageBoardResourceBean DELETE Deletes message with uniqueId = {id} or returns HTTP 404 if message does not exist
/jersey-ejb/app/messages/
(with message as request entity)
MessageBoardResourceBean POST Creates new message and allocates unique id for it

Running the Example

This sample utilizes features of the GlassFish EJB 3.1 container only available in Glassfish v3 build 58 and later versions. This sample will not work with Glassfish v3 Prelude or Preview.

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:

Build and deploy the project by executing maven 2 from the project directory

mvn clean package embedded-glassfish:run

Note: You need at least JDK 1.6 to be able to start embedded Glassfish V3.

From a web browser, visit:

http://localhost:8080/jersey-ejb