On 8/25/10 1:48 PM, Patrick Duin wrote:
> Hello,
>
> I am trying to upgrade jersey in my application from 1.1.5 to 1.3 and
> I am running into some troubles with my authentication in junit tests.
> I am using the grizzly test container with an extra Filter that adds a
> UserPrinciple to my HttpServletRequest.
> My test extends com.sun.jersey.test.framework.JerseyTest and overrides:
>
> @Override
> protected AppDescriptor configure() {
> WebAppDescriptor.Builder builder = new
> WebAppDescriptor.Builder(ComponentRegistryRestService.class.getPackage().getName()).addFilter(DummySecurityFilter.class,
> "DummySecurityFilter");
> return builder.build();
> }
>
>
> My root resource has the HttpServletRequest injected in a field like
> this:
> @Context
> private HttpServletRequest request;
>
> In my tests I then create a request with the proper authentication in
> the header. This works fine for most of my tests. I have one test that
> does some concurrent requests, it fails sometimes. The Grizzly
> FilterChain is not threadsafe and fails on a nullpointer when using
> extra filters (this is in the grizzly version 1.9.18-i used
> by jersey-test-framework-grizzly-1.3). It is supposed to be fixed in
> grizzly 1.9.19 version. Is there any workaround at the moment, am I
> doing something wrong to get this server authentication working?
>
> What I have tried:
> - Use newer version of grizzly, but that is not compatible with the
> Jersey-test-framework-grizzly at the moment.
what does this mean? I'm able to build jersey-test-framework-grizzly
with 1.9.19 without problems.. (I'm going to update this dependency in
the trunk right now)
> - Use jersey-test-framework-http but I keep getting the error: SEVERE:
> Missing dependency for field: private
> javax.servlet.http.HttpServletRequest
> I was using this in my old 1.1.5 implementation without troubles. I
> cannot seem to get rid of this error unless I use Grizzly
> TestContainer. Should I register the HttpServletRequest in the
> resourceConfig somewhere?
>
> Kind Regards,
> Patrick.
>
> ps: sticking to jersey 1.1.5 (with a ContainerRequestFilter instead of
> a javax.servlet.Filter) for now.