JaxRsNote

=Background=
 * JSR311
 * JSR222
 * rs-api https://maven.java.net/content/repositories/releases/javax/ws/rs/javax.ws.rs-api/
 * grizzly https://maven.java.net/content/repositories/releases/org/glassfish/grizzly/
 * Jersey https://jersey.java.net/ download
 * guava/google-collections https://code.google.com/p/guava-libraries/
 * javax.inject https://code.google.com/p/atinject/

=Concept=

Terminology
A Java class that uses JAX-RS annotations to implement a corresponding Web resource. A resource class annotated with @Path. Root resource classes provide the roots of the resource class tree and provide access to sub-resources. A runtime annotation annotated with @HttpMethod. Used to identify the HTTP request method to be handled by a resource method. A method of a resource class annotated with a request method designator that is used to handle requests on the corresponding resource. A method of a resource class that is used to locate sub-resources of the correspond- ing resource. A method of a resource class that is used to handle requests on a sub-resource of the corresponding resource. An implementation of a JAX-RS extension interface. Providers extend the capabilities of a JAX-RS runtime.
 * Resource class
 * Root resource class
 * Request method designator
 * Resource method
 * Sub-resource locator
 * Sub-resource method
 * Provider

Applications
A JAX-RS application consists of:
 * one or more resources
 * and zero or more providers.

Resources
Web resource is implemented as a resource class and requests are handled by resource methods.

Constructors
Root resource classes are instantiated by the JAX-RS runtime and MUST have a public constructor.

A public constructor MAY include parameters annotated with one of the following:
 * @Context,
 * @Header-Param,
 * @CookieParam,
 * @MatrixParam,
 * @QueryParam,
 * @PathParam.

Fields and Properties
When a resource class is instantiated, the values of fields and bean properties annotated with one the follow-ing annotations are set:
 * @MatrixParam Extracts the value of a URI matrix parameter.
 * @QueryParam Extracts the value of a URI query parameter.
 * @PathParam Extracts the value of a URI template parameter.
 * @CookieParam Extracts the value of a cookie.
 * @HeaderParam Extracts the value of a header.
 * @Context Injects an instance of a supported resource.

Resource Methods
Resource methods are methods of a resource class annotated with a request method designator. They are used to handle requests.

Designators:
 * @GET
 * @POST
 * @PUT
 * @DELETE
 * @HEAD

Only public methods may be exposed as resource methods.

Return Type
Resource methods MAY return
 * void
 * Response
 * GenericEntity
 * Java type

Exception
A resource method, sub-resource method or sub-resource locator may throw any checked or unchecked exception.

URI Template
A root resource class is anchored in URI space using the @Path annotation.

The value of the annotation is a relative URI path template whose base URI is provided by the combination of the deployment context and the application path (@ApplicationPath).

A URI path template is a string with zero or more embedded parameters.

Jersey
=Test Driven Development=

Maven

 * run all tests
 * run single test