# 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 path | Resource class | HTTP methods
--- | --- | ---
`/annotated/instance/{p1}/{p2}?q1=<int_value>&q2=<string_value>&q2=<string_value>` | JaxrsInjectionReportingResource | GET
`/annotated/method/{p1}/{p2}?q1=<int_value>&q2=<string_value>&q2=<string_value>` | JaxrsInjectionReportingResource | GET
`/programmatic/{p1}/{p2}?q1=<int_value>&q2=<string_value>&q2=<string_value>` | JaxrsInjectionReportingInflector | GET

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:

> `http://localhost:8080/jaxrs-type-injection/application.wadl`

The resources could be accessed via

> `http://localhost:8080/jaxrs-type-injection/annotated/instance/p1/p2?q1=123&q2=abc&q2=def`

> `http://localhost:8080/jaxrs-type-injection/annotated/method/p1/p2?q1=123&q2=abc&q2=def`

> `http://localhost:8080/jaxrs-type-injection/programmatic/p1/p2?q1=123&q2=abc&q2=def`