title: Jersey - The @Context annotation for injection. How does it work?
body: <p>I was looking at a good <a href="http://www.vogella.com/articles/REST/article.html#crud_class" rel="noreferrer">REST tutorial using Jersey</a>.
  Down the page, there is a web resource that is built which is entitled <code>TodoResource</code> which itself contains two instance variables</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>public class TodoResource {
      @Context
      UriInfo uriInfo;
  
      @Context
      Request request;
  
      String id;
  
      public TodoResource(UriInfo uriInfo, Request request, String id) {
          this.uriInfo = uriInfo;
          this.request = request;
          this.id = id;
      }
  }
  </code></pre>
  
  <p>I was wondering exactly how the <code>UriInfo</code> and <code>Request</code> instance variables are initialized? I know that using the <code>@Context</code> annotation allows for information to be injected, but at what point does this happen? Will this be handled automatically by Jersey?</p>