What does context annotation do in Spring?

jersey, spring

Solution

The purpose is to indicate that the `request` property should be set from the context.

`@Context` is used to inject various HTTP-ish contextual data, from here:

In general @Context can be used to obtain contextual Java types related to the request or response.

API docs (Not horribly useful IMO. Or, perhaps more accurately, horribly-useful.)

Problem

In Rest API design, I am wondering what the exact purpose of the context annotation is? ``` private HttpServletRequest request; @Context public void setRequest(final HttpServletRequest req) { request = req; } ```

Original source