users@jersey.java.net

[Jersey] Injecting _at_Context parameters with Guice on resource methods

From: Cagatay Kavukcuoglu <cagatay_at_kavukcuoglu.org>
Date: Thu, 25 Aug 2011 12:55:40 -0400

I'm using Guice to create small converters that parse pieces of the
HTTP request similar to the example here:

http://codahale.com/what-makes-jersey-interesting-injection-providers/

Right now I have to use the @InjectParam annotation to inject the
converted objects to resource methods:

@GET
@Path(...)
public Response list(@InjectParam ResourcePath folder) {
 ...
}

// in a module
@Provides
@RequestScoped
public ResourcePath resourcePath(UriInfo uriInfo) {
  // do some parsing
}

Is there a way I can use the @Context annotation instead without
creating InjectableProvider instances manually? That would allow me to
use JAX-RS annotations exclusively and not depend on Jersey
annotations in my resource classes.

CK.