users@jersey.java.net

Re: [Jersey] Response Filter and Exceptions

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 08 Oct 2008 16:05:38 +0200

This is fixed in the latest snapshot.

Paul.

On Oct 8, 2008, at 12:02 PM, Paul Sandoz wrote:

>
> On Oct 8, 2008, at 11:47 AM, Paul Sandoz wrote:
>
>>
>> On Oct 8, 2008, at 12:29 AM, Craig Iverson wrote:
>>
>>> I have a filter that implements both ContainerRequestFilter and
>>> ContainerResponseFilter. I was hoping when an Exception was
>>> thrown it would still go through the response filter. This does
>>> not seem to be the case. I have some generic logic I want to
>>> apply to a response no matter what happens. This logic uses data
>>> from the request and sets things in the responses. Any ideas how
>>> to have this generic logic applied to the Exception case?
>>>
>>
>> We have a bug.
>>
>> When exceptions are thrown they may be mapped to responses. Filters
>> can throw exceptions as well as terminate the filter chain and
>> those exceptions can be mapped.
>>
>> I think we need to do the following:
>>
>> 1) Enable response filters to operate on the response regardless of
>> whether it was produced from a request filter
>> a resource class, or mapped from an exception; and
>>
>> 2) If the filter throws an exception and the response was mapped
>> from an exception. Then the filter chain
>> terminates and the exception is mapped to a response.
>>
>
> A refinement for 2): if a response filter throws an exception then
> the filter chain terminates and the exception is mapped to a response.
>
> Paul.
>
>> Will that work for you?
>>
>> Paul.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>