This example demonstrates how to develop RESTful web service with a Servlet 3.0 container.
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 |
This sample utilizes Java EE 6 features of the GlassFish in Glassfish 3.1
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
From a web browser, visit:
http://localhost:8080/jersey-ejb