users@jersey.java.net

[Jersey] Re: Jersey Test Framework, InMemory and _at_Context injection

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Wed, 09 Nov 2011 19:04:27 +0100

Hi Alexis,

You basically need to add an implementation of [1] to your test web app
descriptor classes definition.
The above should return some kind of HttpServletRequest mockup.

More detailed info could be provided as requested.

HTH,

~Jakub

[1]http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/spi/inject/InjectableProvider.html

On 9.11.2011 14:58, Alexis THOMAS wrote:
> Hello,
>
> nice to be able to use brand new 1.10 version of Jersey ;)
>
> I'm facing an already discussed problem while dealing with Test
> Framework InMemory and a @Context annotation inside a Jersey WebService
> all right when using the webservice, and the "@Context
> HttpServletRequest" from my method signature to get the remoteAddr
> but not so good when running tests
>
> Problem was mentionned here earlier in 2011 :
> http://jersey.576304.n2.nabble.com/Servlet-context-injection-fail-while-using-jersey-test-framework-td6484324.html
> "Have you added the support for these injections?"
> -> how to get rid of the problem? how to add the support for these
> injections? how to inject them?
>
> Thanks in advance,
>
> Alexis THOMAS
>