This example demonstrates how to develop RESTful web service with JCDI managed beans and a Servlet 3.0 Web container.
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 from the project directory
mvn clean package embedded-glassfish:run
From a web browser, visit the following URLs:
Description URL Expected Results A managed bean with no use of injection whatsoever http://localhost:8080/jersey-cdi/helloworld
Hello World
Shows injection of context objects into the fields of a managed bean. http://localhost:8080/jersey-cdi/simple
OK GET http://localhost:8080/jersey-cdi/simple
Shows injection of context objects and path parameters into the fields of a managed bean. http://localhost:8080/jersey-cdi/other/c/d
OTHER c d
Shows constructor injection of a path parameter in a managed bean. http://localhost:8080/jersey-cdi/echoconstructor/a
ECHO a
Shows injection of path and query parameters into the fields of a managed bean. http://localhost:8080/jersey-cdi/echofield/b
ECHO null b
A managed bean that uses (but does not inject) a path parameter. http://localhost:8080/jersey-cdi/echo/a
ECHO a
Shows injection of context objects into the fields of a EJB Stateless Session bean. http://localhost:8080/jersey-cdi/ejb/stateless
1
Shows injection of query parameters into the fields of a managed bean. http://localhost:8080/jersey-cdi/jcdibean/per-request
null1
Shows injection of context objects into the fields of a managed bean. http://localhost:8080/jersey-cdi/jcdibean/singleton
1
Shows injection of context objects and query parameters into the fields of a managed bean. http://localhost:8080/jersey-cdi/jcdibean/dependent/per-request
null1
Shows injection of context objects into the fields of a managed bean. http://localhost:8080/jersey-cdi/jcdibean/dependent/singleton
1