On 8/25/10 2:22 PM, Patrick Duin wrote:
>
> On Aug 25, 2010, at 2:00 PM, Pavel Bucek wrote:
>
>> 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)
> Sorry my bad, I couln't find the 1.9.19 version from 
> http://download.java.net/maven/2 so I downloaded it from the grizzly 
> website and installed it to my local maven repo. I forgot to add the 
> transitive dependencies so I got some class not found errors. Bad idea 
> to test these things after a long day of debugging. Are the 1.9.19 
> versions available from a public maven repo? I would love to test this.
yes, looks like 1.9.19 is available, but in the java.net *glassfish* 
repo - see 
http://download.java.net/maven/glassfish/com/sun/grizzly/grizzly-servlet-webserver/
>
>>
>>> - 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.
>>
>