users@jersey.java.net

[Jersey] Re: Container filter and Annotation

From: Go Hori <go_at_livemocha.com>
Date: Tue, 22 Nov 2011 08:46:05 -0800

Thank you for your reply.

I have ContaierResponseFilter implemented and using it with a resource
filter. I did not realize I can potentially use the same implementation
with container filter. A filter is a filter after all, I suppose.

Thanks!
Go

On Tue, Nov 22, 2011 at 8:30 AM, Martin Matula <martin.matula_at_oracle.com>wrote:

> Is it important for you to handle the request that does not match any URI
> in the *request* filter? Can't you handle it in the response filter
> instead? That would allow you to have resource filter for the matching
> cases and response filter for the non-matching cases.
> Martin
>
>
> On 22.11.2011 1:41, go_at_livemocha.com wrote:
>
>> Hello,
>>
>> I have a resource filter that looks at annotations supported by a
>> resource to do a few things. So, this, I believe, is a perfect use
>> case for Resource Filter.
>>
>> Now, I have to make it so that logic in this filter be executed even if
>> there is no resource matching for a request. To do this, I think I
>> need to change my filter to Container Filter. But if I do that, I lose
>> Annotation based configuration.
>>
>> My question is, Is there a way to get a list Annotations supported by a
>> resource in Container Filter? If there is no resource available for a
>> request, some kind of signal (null, an empty list) is sufficient for me
>> to do the right thing.
>>
>> If this is not possible, is is possible to get URI to
>> AbstractResourceMethod mapping in a Sprint servlet filter? If there
>> is, I can move the logic to a servlet...
>>
>> Thanks,
>> Go
>>
>