You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Martin Strohal <ma...@1und1.de> on 2016/04/15 10:52:20 UTC

Configuration of JSON provider

Hi,


I want to configure my JSON output in TomEE 1.7.1, which worked well in TomEE 1.5.2.


I am using a custom sub class of JSONProvider because I want to use vendor specific content types instead of application/json. (In my example I am using application/json to simplify the problem, but that's the cause for the subclass.)


Then I am using openejb.jar:


<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
  <pojo-deployment class-name="jaxrs-appication">
    <properties>
      cxf.jaxrs.providers=json
    </properties>
  </pojo-deployment>
</openejb-jar>

And resources.xml:

  <Service id="json" class-name="WsJsonProvider">
    dropRootElement = true
    supportUnwrapped = true
    dropCollectionWrapperElement = true
    writeXsiType = false
    convertTypesToStrings = true
  </Service>


"WsJsonProvider" is my custom subclass of CXF's JSONProvider:


@Provider
@Produces("application/json")
@Consumes("application/json")
public class WsJsonProvider<T> extends JSONProvider<T> {
}



The result object of my REST call

curl -i "http://localhost:40000/rest-test-1.0.0-SNAPSHOT/v1/users/hello"

?looks like:


{"resultList":{"list":{"@xsi.type":"resultDto1","value":"abc"}}}?


Using the configuration above I would expect:


{"list":{"value":"abc"}}

I have uploaded a sample project reproducing the error:
http://expirebox.com/download/aac16bfadc3afe3a60e00235bcdefb28.html

What's my mistake? Why is my mistake?

Thanks in advance!

Martin

Re: Configuration of JSON provider

Posted by Romain Manni-Bucau <rm...@gmail.com>.
We miss the payload type - of gmail swallowed it.
Le 15 avr. 2016 11:21, "Martin Strohal" <ma...@1und1.de> a écrit :

> Okay, I understand. But I think I have added the relevant code to my
> e-mail. No idea why it works in 1.5.2 and not in 1.7.1...?
>
> Thanks,
> Martin
>
>
> Am 15.04.2016 um 11:09 schrieb Romain Manni-Bucau:
> > Well my point is nobody will download a zip so best way for you to get
> help
> > is to push it on a public site where sources can be browsed.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-04-15 11:06 GMT+02:00 Martin Strohal <ma...@1und1.de>:
> >
> >> Hi Romain,
> >>
> >> if it works (and if you remove the reference to our custom Maven super
> pom
> >> which is not public available), sure.
> >>
> >> But first of all a solution for my problem would be great - I don't
> >> understand why the provider configuration is completely ignored.
> >>
> >> Thanks,
> >> Martin
> >>
> >>
> >> ________________________________________
> >> Von: Romain Manni-Bucau <rm...@gmail.com>
> >> Gesendet: Freitag, 15. April 2016 10:58
> >> An: users@tomee.apache.org
> >> Betreff: Re: Configuration of JSON provider
> >>
> >> Hi Martin
> >>
> >> do you care pushing the project on github/bitbucket/any public trusted
> >> source repository?
> >>
> >>
> >> Romain Manni-Bucau
> >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >> <http://rmannibucau.wordpress.com> | Github <
> >> https://github.com/rmannibucau> |
> >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> >> <http://www.tomitribe.com> | JavaEE Factory
> >> <https://javaeefactory-rmannibucau.rhcloud.com>
> >>
> >> 2016-04-15 10:52 GMT+02:00 Martin Strohal <ma...@1und1.de>:
> >>
> >>> Hi,
> >>>
> >>>
> >>> I want to configure my JSON output in TomEE 1.7.1, which worked well in
> >>> TomEE 1.5.2.
> >>>
> >>>
> >>> I am using a custom sub class of JSONProvider because I want to use
> >> vendor
> >>> specific content types instead of application/json. (In my example I am
> >>> using application/json to simplify the problem, but that's the cause
> for
> >>> the subclass.)
> >>>
> >>>
> >>> Then I am using openejb.jar:
> >>>
> >>>
> >>> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
> >>>   <pojo-deployment class-name="jaxrs-appication">
> >>>     <properties>
> >>>       cxf.jaxrs.providers=json
> >>>     </properties>
> >>>   </pojo-deployment>
> >>> </openejb-jar>
> >>>
> >>> And resources.xml:
> >>>
> >>>   <Service id="json" class-name="WsJsonProvider">
> >>>     dropRootElement = true
> >>>     supportUnwrapped = true
> >>>     dropCollectionWrapperElement = true
> >>>     writeXsiType = false
> >>>     convertTypesToStrings = true
> >>>   </Service>
> >>>
> >>>
> >>> "WsJsonProvider" is my custom subclass of CXF's JSONProvider:
> >>>
> >>>
> >>> @Provider
> >>> @Produces("application/json")
> >>> @Consumes("application/json")
> >>> public class WsJsonProvider<T> extends JSONProvider<T> {
> >>> }
> >>>
> >>>
> >>>
> >>> The result object of my REST call
> >>>
> >>> curl -i "
> http://localhost:40000/rest-test-1.0.0-SNAPSHOT/v1/users/hello"
> >>>
> >>> ?looks like:
> >>>
> >>>
> >>> {"resultList":{"list":{"@xsi.type":"resultDto1","value":"abc"}}}?
> >>>
> >>>
> >>> Using the configuration above I would expect:
> >>>
> >>>
> >>> {"list":{"value":"abc"}}
> >>>
> >>> I have uploaded a sample project reproducing the error:
> >>> http://expirebox.com/download/aac16bfadc3afe3a60e00235bcdefb28.html
> >>>
> >>> What's my mistake? Why is my mistake?
> >>>
> >>> Thanks in advance!
> >>>
> >>> Martin
> >>>
>
>

Re: Configuration of JSON provider

Posted by Martin Strohal <ma...@1und1.de>.
Okay, I understand. But I think I have added the relevant code to my
e-mail. No idea why it works in 1.5.2 and not in 1.7.1...?

Thanks,
Martin


Am 15.04.2016 um 11:09 schrieb Romain Manni-Bucau:
> Well my point is nobody will download a zip so best way for you to get help
> is to push it on a public site where sources can be browsed.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-04-15 11:06 GMT+02:00 Martin Strohal <ma...@1und1.de>:
>
>> Hi Romain,
>>
>> if it works (and if you remove the reference to our custom Maven super pom
>> which is not public available), sure.
>>
>> But first of all a solution for my problem would be great - I don't
>> understand why the provider configuration is completely ignored.
>>
>> Thanks,
>> Martin
>>
>>
>> ________________________________________
>> Von: Romain Manni-Bucau <rm...@gmail.com>
>> Gesendet: Freitag, 15. April 2016 10:58
>> An: users@tomee.apache.org
>> Betreff: Re: Configuration of JSON provider
>>
>> Hi Martin
>>
>> do you care pushing the project on github/bitbucket/any public trusted
>> source repository?
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> <http://rmannibucau.wordpress.com> | Github <
>> https://github.com/rmannibucau> |
>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> <http://www.tomitribe.com> | JavaEE Factory
>> <https://javaeefactory-rmannibucau.rhcloud.com>
>>
>> 2016-04-15 10:52 GMT+02:00 Martin Strohal <ma...@1und1.de>:
>>
>>> Hi,
>>>
>>>
>>> I want to configure my JSON output in TomEE 1.7.1, which worked well in
>>> TomEE 1.5.2.
>>>
>>>
>>> I am using a custom sub class of JSONProvider because I want to use
>> vendor
>>> specific content types instead of application/json. (In my example I am
>>> using application/json to simplify the problem, but that's the cause for
>>> the subclass.)
>>>
>>>
>>> Then I am using openejb.jar:
>>>
>>>
>>> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
>>>   <pojo-deployment class-name="jaxrs-appication">
>>>     <properties>
>>>       cxf.jaxrs.providers=json
>>>     </properties>
>>>   </pojo-deployment>
>>> </openejb-jar>
>>>
>>> And resources.xml:
>>>
>>>   <Service id="json" class-name="WsJsonProvider">
>>>     dropRootElement = true
>>>     supportUnwrapped = true
>>>     dropCollectionWrapperElement = true
>>>     writeXsiType = false
>>>     convertTypesToStrings = true
>>>   </Service>
>>>
>>>
>>> "WsJsonProvider" is my custom subclass of CXF's JSONProvider:
>>>
>>>
>>> @Provider
>>> @Produces("application/json")
>>> @Consumes("application/json")
>>> public class WsJsonProvider<T> extends JSONProvider<T> {
>>> }
>>>
>>>
>>>
>>> The result object of my REST call
>>>
>>> curl -i "http://localhost:40000/rest-test-1.0.0-SNAPSHOT/v1/users/hello"
>>>
>>> ?looks like:
>>>
>>>
>>> {"resultList":{"list":{"@xsi.type":"resultDto1","value":"abc"}}}?
>>>
>>>
>>> Using the configuration above I would expect:
>>>
>>>
>>> {"list":{"value":"abc"}}
>>>
>>> I have uploaded a sample project reproducing the error:
>>> http://expirebox.com/download/aac16bfadc3afe3a60e00235bcdefb28.html
>>>
>>> What's my mistake? Why is my mistake?
>>>
>>> Thanks in advance!
>>>
>>> Martin
>>>


Re: Configuration of JSON provider

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Well my point is nobody will download a zip so best way for you to get help
is to push it on a public site where sources can be browsed.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-04-15 11:06 GMT+02:00 Martin Strohal <ma...@1und1.de>:

> Hi Romain,
>
> if it works (and if you remove the reference to our custom Maven super pom
> which is not public available), sure.
>
> But first of all a solution for my problem would be great - I don't
> understand why the provider configuration is completely ignored.
>
> Thanks,
> Martin
>
>
> ________________________________________
> Von: Romain Manni-Bucau <rm...@gmail.com>
> Gesendet: Freitag, 15. April 2016 10:58
> An: users@tomee.apache.org
> Betreff: Re: Configuration of JSON provider
>
> Hi Martin
>
> do you care pushing the project on github/bitbucket/any public trusted
> source repository?
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-04-15 10:52 GMT+02:00 Martin Strohal <ma...@1und1.de>:
>
> > Hi,
> >
> >
> > I want to configure my JSON output in TomEE 1.7.1, which worked well in
> > TomEE 1.5.2.
> >
> >
> > I am using a custom sub class of JSONProvider because I want to use
> vendor
> > specific content types instead of application/json. (In my example I am
> > using application/json to simplify the problem, but that's the cause for
> > the subclass.)
> >
> >
> > Then I am using openejb.jar:
> >
> >
> > <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
> >   <pojo-deployment class-name="jaxrs-appication">
> >     <properties>
> >       cxf.jaxrs.providers=json
> >     </properties>
> >   </pojo-deployment>
> > </openejb-jar>
> >
> > And resources.xml:
> >
> >   <Service id="json" class-name="WsJsonProvider">
> >     dropRootElement = true
> >     supportUnwrapped = true
> >     dropCollectionWrapperElement = true
> >     writeXsiType = false
> >     convertTypesToStrings = true
> >   </Service>
> >
> >
> > "WsJsonProvider" is my custom subclass of CXF's JSONProvider:
> >
> >
> > @Provider
> > @Produces("application/json")
> > @Consumes("application/json")
> > public class WsJsonProvider<T> extends JSONProvider<T> {
> > }
> >
> >
> >
> > The result object of my REST call
> >
> > curl -i "http://localhost:40000/rest-test-1.0.0-SNAPSHOT/v1/users/hello"
> >
> > ?looks like:
> >
> >
> > {"resultList":{"list":{"@xsi.type":"resultDto1","value":"abc"}}}?
> >
> >
> > Using the configuration above I would expect:
> >
> >
> > {"list":{"value":"abc"}}
> >
> > I have uploaded a sample project reproducing the error:
> > http://expirebox.com/download/aac16bfadc3afe3a60e00235bcdefb28.html
> >
> > What's my mistake? Why is my mistake?
> >
> > Thanks in advance!
> >
> > Martin
> >
>

AW: Configuration of JSON provider

Posted by Martin Strohal <ma...@1und1.de>.
Hi Romain,

if it works (and if you remove the reference to our custom Maven super pom which is not public available), sure.

But first of all a solution for my problem would be great - I don't understand why the provider configuration is completely ignored.

Thanks,
Martin


________________________________________
Von: Romain Manni-Bucau <rm...@gmail.com>
Gesendet: Freitag, 15. April 2016 10:58
An: users@tomee.apache.org
Betreff: Re: Configuration of JSON provider

Hi Martin

do you care pushing the project on github/bitbucket/any public trusted
source repository?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-04-15 10:52 GMT+02:00 Martin Strohal <ma...@1und1.de>:

> Hi,
>
>
> I want to configure my JSON output in TomEE 1.7.1, which worked well in
> TomEE 1.5.2.
>
>
> I am using a custom sub class of JSONProvider because I want to use vendor
> specific content types instead of application/json. (In my example I am
> using application/json to simplify the problem, but that's the cause for
> the subclass.)
>
>
> Then I am using openejb.jar:
>
>
> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
>   <pojo-deployment class-name="jaxrs-appication">
>     <properties>
>       cxf.jaxrs.providers=json
>     </properties>
>   </pojo-deployment>
> </openejb-jar>
>
> And resources.xml:
>
>   <Service id="json" class-name="WsJsonProvider">
>     dropRootElement = true
>     supportUnwrapped = true
>     dropCollectionWrapperElement = true
>     writeXsiType = false
>     convertTypesToStrings = true
>   </Service>
>
>
> "WsJsonProvider" is my custom subclass of CXF's JSONProvider:
>
>
> @Provider
> @Produces("application/json")
> @Consumes("application/json")
> public class WsJsonProvider<T> extends JSONProvider<T> {
> }
>
>
>
> The result object of my REST call
>
> curl -i "http://localhost:40000/rest-test-1.0.0-SNAPSHOT/v1/users/hello"
>
> ?looks like:
>
>
> {"resultList":{"list":{"@xsi.type":"resultDto1","value":"abc"}}}?
>
>
> Using the configuration above I would expect:
>
>
> {"list":{"value":"abc"}}
>
> I have uploaded a sample project reproducing the error:
> http://expirebox.com/download/aac16bfadc3afe3a60e00235bcdefb28.html
>
> What's my mistake? Why is my mistake?
>
> Thanks in advance!
>
> Martin
>

Re: Configuration of JSON provider

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

do you care pushing the project on github/bitbucket/any public trusted
source repository?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-04-15 10:52 GMT+02:00 Martin Strohal <ma...@1und1.de>:

> Hi,
>
>
> I want to configure my JSON output in TomEE 1.7.1, which worked well in
> TomEE 1.5.2.
>
>
> I am using a custom sub class of JSONProvider because I want to use vendor
> specific content types instead of application/json. (In my example I am
> using application/json to simplify the problem, but that's the cause for
> the subclass.)
>
>
> Then I am using openejb.jar:
>
>
> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
>   <pojo-deployment class-name="jaxrs-appication">
>     <properties>
>       cxf.jaxrs.providers=json
>     </properties>
>   </pojo-deployment>
> </openejb-jar>
>
> And resources.xml:
>
>   <Service id="json" class-name="WsJsonProvider">
>     dropRootElement = true
>     supportUnwrapped = true
>     dropCollectionWrapperElement = true
>     writeXsiType = false
>     convertTypesToStrings = true
>   </Service>
>
>
> "WsJsonProvider" is my custom subclass of CXF's JSONProvider:
>
>
> @Provider
> @Produces("application/json")
> @Consumes("application/json")
> public class WsJsonProvider<T> extends JSONProvider<T> {
> }
>
>
>
> The result object of my REST call
>
> curl -i "http://localhost:40000/rest-test-1.0.0-SNAPSHOT/v1/users/hello"
>
> ?looks like:
>
>
> {"resultList":{"list":{"@xsi.type":"resultDto1","value":"abc"}}}?
>
>
> Using the configuration above I would expect:
>
>
> {"list":{"value":"abc"}}
>
> I have uploaded a sample project reproducing the error:
> http://expirebox.com/download/aac16bfadc3afe3a60e00235bcdefb28.html
>
> What's my mistake? Why is my mistake?
>
> Thanks in advance!
>
> Martin
>