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.
Will that work for you?
Paul.