Jersey CDI Sample

This example demonstrates how to develop RESTful web service with JCDI managed beans and a Servlet 3.0 Web container.

Running the Example

This example currently works only with a standalone GlassFish 3.1.x instance. The easiest way to get the application running is to use the GlassFish Update Center client, install "Jersey examples and documentation" IPS module from there and follow instructions at the module README file in order to deploy the example. If you have already installed from the Update Center, the module readme file should be accessible here

After you successfully deploy the application, 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