dev@jersey.java.net

Re: [Jersey] jersey test framework filters?

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Wed, 14 Apr 2010 10:08:25 +0200

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
>
>