You specify that context information is to be injected into a field or a resource method parameter
using the javax.ws.rs.core.Context
annotation. Annotating a field or
parameter of one of the context types will instruct the runtime to inject the appropriate context
information into the annotated field or parameter.
Table 9.1 lists the types of context information that can be injected and the objects that support them.
Table 9.1. Context types
Context information is available to the following parts of a JAX-RS application:
resource classes
resource methods
entity providers
exception mappers
All context information injected using the @Context
annotation is
specific to the current request. This is true in all cases including entity providers and
exception mappers.
The JAX-RS framework allows developers to extend the types of information that can be injected
using the context mechanism. You add custom contexts by implementing a
Context<T>
object and registering it with the runtime.
For information on creating custom contexts see Adding custom contexts.