You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Karl Kildén <ka...@gmail.com> on 2016/09/23 08:33:39 UTC

Rest problem with tomee 7.0

Hi!

Using TomEE 7.x our rest endpoints now expect:

{
        "name":"Name",
        "occupation":"RestProblemSolver"
}


But our partner sends


{
    "simpleDTO": {
        "name":"Name",
        "occupation":"RestProblemSolver"
 }

Can I configure johnzon so it expects the DTO root name like this? Or must
configure to use jettison?

Cheers

Re: Rest problem with tomee 7.0

Posted by Karl Kildén <ka...@gmail.com>.
I am adding the IRC help I got here for future reference from fellow
googlers

[10:54] <karlkilden> Any pointers to write a reader? :)
[10:55] <rmannibucau>
https://github.com/apache/johnzon/blob/master/johnzon-jaxrs/src/main/java/org/apache/johnzon/jaxrs/DelegateProvider.java
[10:55] <rmannibucau> this is not a johnzon specific code (well it is but i
mean it is a plain jaxrs delegation sample)
[10:55] <rmannibucau> you can surely unwrap in readFrom
[10:55] <rmannibucau> that said if you modify the app i would add a wrapper
probably
[10:56] <rmannibucau> SimpleDtoWrapper { SimpleDto: {...}}
[10:56] <rmannibucau> easier to maintain/understand
[11:00] <karlkilden> rmannibucau: We tested the wrapper strategy because we
like johnzon and it works, thanks!


On 23 September 2016 at 10:51, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Hi
>
> 2016-09-23 10:33 GMT+02:00 Karl Kildén <ka...@gmail.com>:
>
> > Hi!
> >
> > Using TomEE 7.x our rest endpoints now expect:
> >
> > {
> >         "name":"Name",
> >         "occupation":"RestProblemSolver"
> > }
> >
> >
> > But our partner sends
> >
> >
> > {
> >     "simpleDTO": {
> >         "name":"Name",
> >         "occupation":"RestProblemSolver"
> >  }
> >
> > Can I configure johnzon so it expects the DTO root name like this? Or
> must
> > configure to use jettison?
> >
> >
> Johnzon doesnt support that to stay aligned on jsonb so either you wrap
> your payload on the server (or unwrap it in a reader) or you can configure
> jettison
>
>
> > Cheers
> >
>

Re: Rest problem with tomee 7.0

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

2016-09-23 10:33 GMT+02:00 Karl Kildén <ka...@gmail.com>:

> Hi!
>
> Using TomEE 7.x our rest endpoints now expect:
>
> {
>         "name":"Name",
>         "occupation":"RestProblemSolver"
> }
>
>
> But our partner sends
>
>
> {
>     "simpleDTO": {
>         "name":"Name",
>         "occupation":"RestProblemSolver"
>  }
>
> Can I configure johnzon so it expects the DTO root name like this? Or must
> configure to use jettison?
>
>
Johnzon doesnt support that to stay aligned on jsonb so either you wrap
your payload on the server (or unwrap it in a reader) or you can configure
jettison


> Cheers
>