dev@jersey.java.net

Re: [Jersey] jersey test framework filters?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 14 Apr 2010 15:28:55 +0200

On Apr 14, 2010, at 3:10 PM, James Russo wrote:

> Hello,
>
> One other thing. What is the reasoning behind not being able to
> specify a filter and a custom servlet container at the same time? I
> see that when I specify a servletClass (Spring in my instance) it
> resets the filter (spring delegating filter in my instance) to null
> and then I set a filter it resets the servlet to null.
>

That was our focus on the limited design of just building web app
descriptor state just for the Jersey servlet container and extensions
of as a filter or servlet, that has init params, rather than being a
general programatic way of building state of a web app.

AppDescriptor is extensible so we could do something more general,
that has the concept of zero or more filters each of which may have
zero or more init params, without breaking the existing API.

Paul.

> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>