tree: 12ee9c6e54816c082ae5b2ab6dd359f6c33750ef [path history] [tgz]
  1. src/
  2. pom.xml
  3. README.MD
examples/jaxrs-types-injection/README.MD

JAX-RS Types Injection Example

This example demonstrates injection of various runtime information into Jersey/JAX-RS resources.

A simple application consists of two simple resources: One is a typical JAX-RS @Path annotated resource. The second resource is created programmatically using the new Jeresy 2 programmatic resource binding API. Both resources inject the same information and produce the report that is returned in the response back to the client.

Contents

The JAX-RS @Path annotated web resource is implemented by the

org.glassfish.jersey.examples.jaxrstypeinjection.JaxrsInjectionReportingResource

class. The programmatic resource is implemented by the

org.glassfish.jersey.examples.jaxrstypeinjection.JaxrsInjectionReportingInflector class.

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

URI pathResource classHTTP methods
/annotated/instance/{p1}/{p2}?q1=<int_value>&q2=<string_value>&q2=<string_value>JaxrsInjectionReportingResourceGET
/annotated/method/{p1}/{p2}?q1=<int_value>&q2=<string_value>&q2=<string_value>JaxrsInjectionReportingResourceGET
/programmatic/{p1}/{p2}?q1=<int_value>&q2=<string_value>&q2=<string_value>JaxrsInjectionReportingInflectorGET

Please note that the value of the q1 URI query parameter is expected

Running the Example

Run the example as follows:

mvn clean compile exec:java

This deploys the JAX-RS Types Injection Example using Grizzly

A WADL description may be accessed at the URL:

The resources could be accessed via