tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From COURTAULT Francois <Francois.Courta...@gemalto.com>
Subject RE: Not the same behaviour between Johnzon and Jackson
Date Mon, 03 Apr 2017 07:45:08 GMT
Hello Romain,

 I have read the specification and I haven't seen what you have mentioned.
In ยง4.2.1: Message Body Reader, point 5, it is written:
"If step 4 locates a suitable MessageBodyReader then use its readFrom method to map the entity
body to the desired Java type."

But the behavior of the readFrom is not really described.
I hope it will be clarified in JAX-RS 2.1 specification with JSON-B ....

Best Regards.

-----Original Message-----
From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
Sent: lundi 3 avril 2017 09:02
To: users@tomee.apache.org
Subject: Re: Not the same behaviour between Johnzon and Jackson

Hello

2017-04-03 9:00 GMT+02:00 COURTAULT Francois <Francois.Courtault@gemalto.com
>:

> Hello,
>
> I have written a simple JAX-RS endpoint (POST) which takes an object
> which contain one String field annotated @NotNull.
> The POST method returns the object received.
>
> Then I invoke this endpoint:
>
> -          Johnzon:
>
> o   If I send a payload with one field which doesn't match the field name
> of the Class defined at server side: I get a 200 OK and a returned
> payload empty
>
> o   If I send a payload with 2 fields whether the second one is valuated
> or not: I get a 200 OK and a returned payload empty
>
> -          Jackson:
>
> o   If I send a payload with one field which doesn't match the field name
> of the Class defined at server side: I get a 500 KO with
> UnrecognizedPropertyException
>
> o   If I send a payload with 2 fields whether the second one is valuated
> or not: I get a 500 OK with UnrecognizedPropertyException
>
> What is the right behavior (Johnzon or Jackson) ? Is this behavior
> defined in the JAX-RS 2.0 specification ?
>
>
Right = none
Defined in JAXRS = none (this is jsonp which is lower level, jsonb will be like johnzon but
in EE 8 only)

Note that you can customize jackson to ignore unknown fields and behave as johnzon, just different
defaults


> Best Regards.
> ________________________________
> This message and any attachments are intended solely for the
> addressees and may contain confidential information. Any unauthorized
> use or disclosure, either whole or partial, is prohibited.
> E-mails are susceptible to alteration. Our company shall not be liable
> for the message if altered, changed or falsified. If you are not the
> intended recipient of this message, please delete it and notify the sender.
> Although all reasonable efforts have been made to keep this
> transmission free from viruses, the sender will not be liable for
> damages caused by a transmitted virus.
>
________________________________
 This message and any attachments are intended solely for the addressees and may contain confidential
information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if
altered, changed or falsified. If you are not the intended recipient of this message, please
delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses,
the sender will not be liable for damages caused by a transmitted virus.
Mime
View raw message