users@jersey.java.net

[Jersey] Re: Cannot get ContextResolver<T> to work. (Stand-alone example included.)

From: Martynas Jusevi?ius <martynas_at_graphity.org>
Date: Tue, 11 Feb 2014 21:25:58 +0100

Are you sure you don't need to use Providers.getContextResolver()? I
think this question is about the same issue:
http://stackoverflow.com/questions/3047400/using-context-provider-and-contextresolver-in-jax-rs

On Tue, Feb 11, 2014 at 9:01 PM, <gima_at_iki.fi> wrote:
> Evening,
>
> Problem:
> To my understanding ContextResolver<T> should provide instance(s) of T. Also
> to my understanding when I register ContextResolver<T> with Jersey, fields
> of type T in a @Path annotated class should be filled, assuming they are
> annotated with @Context, of course.
>
> Question:
> The said field stays null no matter what. Am I doing or understanding
> something incorrectly?
>
> I have an example project, and the three classes in question linked below
> for easy access (Main, TestClassResolver and HttpResource).
>
> * Main:
> https://github.com/gima/jerseyContextResolverExample/blob/master/src/main/java/notdf/Main.java
>
> * TestClassResolver:
> https://github.com/gima/jerseyContextResolverExample/blob/master/src/main/java/notdf/TestClassResolver.java
>
> * HttpResource:
> https://github.com/gima/jerseyContextResolverExample/blob/master/src/main/java/notdf/HttpResource.java
>
> * Project Root: https://github.com/gima/jerseyContextResolverExample
>
>
> -Gima
>