dev@jersey.java.net

Re: [Jersey] jersey test framework filters?

From: James Russo <jr_at_halo3.net>
Date: Wed, 14 Apr 2010 07:38:05 -0400

Hello Pavel,

I was using 1.1.2-ea, but I will check out 1.2-SNAPSHOT. However, it would also be nice to specify the name of the filter since in my case it is expected to be "springSecurityFilterChain". I need to figure out if this can be changed, but I really would prefer to not have to change applicationContext to "jerseyfilter" for the test cases. I would think simply providing another method Filter(Class filterClass, String filterName) to builder would make this work.

As an aside, I am also looking to add SSL support to the test framework (so that some requests are correctly tagged isSecure()). Any thoughts on its implementation? I would think that we need some type of SSLConfiguration object which would be passed into the builder and that SSLConfiguration object would point to the keystore, have keystore password, etc. I am not sure how the others containers besides grizzly work but would think they would all need the same information. I would welcome some discussion on the topic. Unless this is already implemented in 1.2-SNAPSHOT.. ;-)

Thanks,

-jr
 
On Apr 14, 2010, at 4:08 AM, Pavel Bucek wrote:

> Hello James,
>
> please see inline.
>
>
> James Russo wrote:
>> Hello,
>> I have some resources which are behind URLs protected by Spring Security (Basic Auth).. I'm trying to make use of the test framework, but it doesn't seem to be working with the filter. The filter specified on the builder never seems to make it to the Servlet Adapter on grizzly?
>>
>> in GrizzlyWebTestContainerFactory, I see the (single?) filter assigned to the filterClass variable, but then nothing is done with it. It would appear to me that it needs to be set in the ServletAdapter via the addFilter method?
>>
> which version of jersey are you using?
>
> I see following code in 1.2-SNAPSHOT:
>
> (GrizzlyWebTestContainerFactory.java:177-185)
>
> // Filter support
> if ( filterClass!=null ) {
> try {
> sa.addFilter((Filter) filterClass.newInstance(), "jerseyfilter", initParams); } catch (InstantiationException ex) { throw new TestContainerException(ex);
> } catch (IllegalAccessException ex) { throw new TestContainerException(ex);
> }
> }
>
> Can you provide a testcase (simple maven-based project would be perfect)?
>
>
> Regards,
>
> Pavel
>> I'll take a stab and making it work if someone can point me towards anon svn?
>>
>> thanks,
>>
>> -jr
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>