jsr339-experts@jax-rs-spec.java.net

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

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Fri, 16 Nov 2012 16:32:21 -0500

On Nov 13, 2012, at 12:25 PM, Sergey Beryozkin <sberyozkin_at_talend.com> wrote:

> Hi,
>
> CXF user has pointed out that the specification requires that WAE exception mapper is not to be used to map a given WAE to Response if
> WAE Response entity is not null.

 Yes, that's according to 3.3.4 and has been like that since 1.X.

>
> Is it what Jersey and RestEasy do ?

 I'll check on Jersey and get back to you --I assume that's what Jersey does.

> CXF lets custom WAE mappers manage all WAEs, though of course the custom mapper may choose to somehow modify the original WAE Response entity if any.
>
> I'd rather prefer the mappers see all WAEe (and say NotFoundException mappers see all the NFE exceptions, whether or not NFE Response entity is null), example, to make sure all WAE isntances can be given some common treatment like logging them, etc.

 If there's a response with an entity, I'm assuming the rationale was that there was no need for mapping. Changing this behavior would not be backward compatible. Let me get back to you on this one.

-- Santiago