dev@jersey.java.net

Re: [Jersey] jersey test framework filters?

From: James Russo <jr_at_halo3.net>
Date: Wed, 14 Apr 2010 11:24:11 -0400

> I concur, there is definitely room for improvements and it shouldn't be hard to improve current WebAppDescriptor.Builder (or do another AppDescriptor descendant) which will support multiple (named) filters. I can look into it if you want.
>
> On the other hand, we won't be able to support everything on embedded containers and I would definitely recommend using external test container for complicated applications - it is easier to write tests and its always good when you have testing environment as close as possible to production.

Let me know what I can do to help. I'll outline what I am trying...

I am trying to test a resource which is protected by SpringSecurity, so I need to have a DelegatingFilterProxy with the name of "springSecurityFilterChain" added to the container.

Beyond that, I'm trying to unit test a resource which is decorated with my @SecureTransportRequired annotation which looks at the Request object and tests for isSecure(). This brings in my need for SSL on Grizzly which will set this flag. If there is a way to fake out this flag when doing my tests, I'm all for that. Much simpler then dealing with certificates and setting up a real SSL Grizzly instance..

So, I basically need access to GrizzlyWebServer object (to set SSL), and then also ServletAdapter in order too set filterName other then "jersey-filter"..I'd propose just giving another filter method which takes the filterName, but this still gives me issues with having the servlet class getting set to null when adding a filter..

Thanks,

-jr