users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: WebApplicationException Response entity and exception mappers

From: Bill Burke <bburke_at_redhat.com>
Date: Tue, 20 Nov 2012 09:04:56 -0500

On 11/20/2012 5:42 AM, Sergey Beryozkin wrote:
> Let me summarize.
>
> One one hand the spec provides for the optimization in cases where WAE
> Response entity is not null. On the other hand, this optimization leads
> to the issue where an application code reports WAE with Response having
> an entity and also with the cause exception for the benefit of the WAE
> mapper.
>
> I'd like to propose one of the following:
>
> 1. Keep the current optimization in place but update the spec to say
> that "if WAE Response entity is null or WAE cause exception is not null
> - use the mapper, otherwise - use WAE Response entity directly"
>
> 2. Drop the optimization - I'd expect any custom mapper check WAE
> Response anyway before creating some custom Response instead and
> dropping this optimization would require a mapper to check if entity is
> not null - guess most of the mappers do it all the time anyway...
>

In Resteasy, we allow you to write a mapper for any exception class, so
I vote #2.

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com