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

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

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Fri, 16 Nov 2012 23:05:08 +0000

On 16/11/12 21:32, Santiago Pericas-Geertsen wrote:
>
> 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.

What is about the WAE (and subclass) constructors accepting 'Response &
Throwable' ? What is going to happen to this 'Throwable' - the mapper
whose job do something on WAE causes won't be invoked and the cause
won't be handled

Sergey

> Changing this behavior would not be backward compatible. Let me get back to you on this one.
>
> -- Santiago
>