[Jersey] Re: Can _at_Context annotation be used be used in any class?

From: Pavel Bucek <>
Date: Fri, 17 Feb 2012 15:20:10 +0100


@Context annotated fields/params can be injected only into classes which
are managed by Jersey. Resource and providers classes for example.

If I understand correctly what you are doing, you should be able to
create constructor for ObjectWrapper which would take UriInfo injected
into current resource.


On 2/17/12 3:03 PM, Farrukh Najmi wrote:
> Hi Guys,
> I am trying to use the "@Context UriInfo uriInfo;" annotation in a
> ObjectWRapper impl class for a freemarker template and finding that it
> is not being set.
> The package for the class is declared in the init property
> "" for the
> com.sun.jersey.spi.spring.container.servlet.SpringServlet used by the
> webapp for my REST endpoint.
> Is there some other restriction that could be preventing jersey
> runtime to be setting the "@Context UriInfo uriInfo;"?
> Thanks for any guidance on this.