users@jersey.java.net

[Jersey] _at_Context HttpServletRequest not injected in Grizzly2 JerseyTest

From: Stevo Slavić <sslavic_at_gmail.com>
Date: Wed, 29 Oct 2014 23:52:52 +0100

Hello Jersey community,

In ExceptionMapper implementation I have HttpServletRequest field,
annotated with @Context. When running application in servlet container,
field gets injected appropriately.

In a resource test extending JerseyTest, with
jersey-test-framework-provider-grizzly2 provider, exception gets thrown and
mentioned exception mapper handles the exception. Problem is that the
request does not get injected - it is null.
Same exception mapper has UriInfo field, also annotated with @Context, and
in that test it gets injected well.

Am I doing something wrong? Are my expectations wrong that this should
work? Should I enable something? Is this a bug?

I'm using jersey 2.13

Kind regards,
Stevo Slavic.