tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris.Christo" <chris.chri...@mail.com>
Subject Re: JAX-RS properties - dropRootElement & supportUnwrapped
Date Wed, 12 Jun 2013 11:23:54 GMT
Finally got this working now, thanks.

It was a strange reason why it wasn't working, but it was basically down to some bad character
(encoding or mistake) I had in the <Service> block. I typed it out manually and it worked.
I compared the one I typed out to the one I was using before and couldn't find any difference.
Yet still when I used the one I typed out it worked and when I used the one I had copied from
before it didn't work. Very strange. Maybe some tab character or something, I don't know...


Anyway, thanks a lot for adding the service config to openejb.xml - love it!



Chris Christo

---
Twitter: https://twitter.com/ChrisChristo7
Tumblr: http://chrischristo7.tumblr.com
LinkedIn: http://uk.linkedin.com/in/chrischristo
GitHub: https://github.com/ChrisChristo

On 7 Jun 2013, at 23:57, Romain Manni-Bucau <rmannibucau@gmail.com> wrote:

> Yep and tested.
> Le 8 juin 2013 00:47, "Chris.Christo" <chris.christo@mail.com> a écrit :
> 
>> Hey, I've updated (svn) updated and mvn installed several times my local
>> tomee since your jira fix, but still not working.
>> 
>> It works when I have it in resources.xml but not when in openejb.xml
>> 
>> <Service id="json"
>> class-name="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>       dropRootElement = true
>>       supportUnwrapped = true
>> </Service>
>> 
>> You sure its committed and working correctly?
>> 
>> Chris Christo
>> 
>> ---
>> Twitter: https://twitter.com/ChrisChristo7
>> Tumblr: http://chrischristo7.tumblr.com
>> LinkedIn: http://uk.linkedin.com/in/chrischristo
>> GitHub: https://github.com/ChrisChristo
>> 
>> On 7 Jun 2013, at 15:06, Romain Manni-Bucau <rmannibucau@gmail.com> wrote:
>> 
>>> got it
>>> 
>>> https://issues.apache.org/jira/browse/TOMEE-965
>>> 
>>> *Romain Manni-Bucau*
>>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>>> *Blog: **http://rmannibucau.wordpress.com/*<
>> http://rmannibucau.wordpress.com/>
>>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>> *Github: https://github.com/rmannibucau*
>>> 
>>> 
>>> 
>>> 2013/6/7 Chris.Christo <chris.christo@mail.com>
>>> 
>>>> Yeah thanks Romain I got that too but what I'm after is:
>>>> 
>>>> 
>>>> this setting:
>>>> 
>>>>> <resources>
>>>>>      <Service id="json"
>>>>> class-name="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>              dropRootElement = true
>>>>>              supportUnwrapped = true
>>>>>      </Service>
>>>>> </resources>
>>>> 
>>>> in system.properties or openejb.xml and not ejb jar specific
>>>> META-INF/resources.
>>>> 
>>>> Is that not possible?
>>>> 
>>>> Otherwise by having it within resources.xml (which gets packaged with
>> the
>>>> individual jar) its a specific setting to that ejb jar.
>>>> 
>>>> I want a global config done using the server config files.
>>>> 
>>>> 
>>>> Chris Christo
>>>> 
>>>> ---
>>>> Twitter: https://twitter.com/ChrisChristo7
>>>> Tumblr: http://chrischristo7.tumblr.com
>>>> LinkedIn: http://uk.linkedin.com/in/chrischristo
>>>> GitHub: https://github.com/ChrisChristo
>>>> 
>>>> On 7 Jun 2013, at 14:49, Romain Manni-Bucau <rmannibucau@gmail.com>
>> wrote:
>>>> 
>>>>> seems to work,
>>>>> 
>>>>> i just added to conf/system.properties:
>>>>> 
>>>>> cxf.jaxrs.providers = json
>>>>> 
>>>>> and to src/main/resources/META-INF/resources.xml:
>>>>> 
>>>>> <resources>
>>>>>      <Service id="json"
>>>>> class-name="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>              dropRootElement = true
>>>>>              supportUnwrapped = true
>>>>>      </Service>
>>>>> </resources>
>>>>> 
>>>>> *Romain Manni-Bucau*
>>>>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>>>>> *Blog: **http://rmannibucau.wordpress.com/*<
>>>> http://rmannibucau.wordpress.com/>
>>>>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>>>> *Github: https://github.com/rmannibucau*
>>>>> 
>>>>> 
>>>>> 
>>>>> 2013/6/7 Chris.Christo <chris.christo@mail.com>
>>>>> 
>>>>>> Ok I'm still a little confused as to where and what I should be
>>>>>> specifying, so I put together a basic app and just set everything
>>>>>> exhaustively:
>>>>>> 
>>>>>> system.properties:
>>>>>>      openejb.jaxrs.providers.auto=true
>>>>>> 
>>>>>>      dropRootElement = true
>>>>>>      supportUnwrapped = true
>>>>>> 
>>>>>>      cxf.jaxrs.providers = json,
>>>>>> org.apache.cxf.jaxrs.provider.json.JSONProvider
>>>>>>      openejb.cxf.jaxrs.providers = json,
>>>>>> org.apache.cxf.jaxrs.provider.json.JSONProvider
>>>>>> 
>>>>>>      cxf.jax-rs.providers = json,
>>>>>> org.apache.cxf.jaxrs.provider.json.JSONProvider
>>>>>>      openejb.cxf.jax-rs.providers = json,
>>>>>> org.apache.cxf.jaxrs.provider.json.JSONProvider
>>>>>> 
>>>>>>      cxf.jaxrs.providers.dropRootElement = true
>>>>>>      cxf.jaxrs.providers.supportUnwrapped = true
>>>>>> 
>>>>>>      openejb.cxf.jaxrs.providers.dropRootElement = true
>>>>>>      openejb.cxf.jaxrs.providers.supportUnwrapped = true
>>>>>> 
>>>>>>      org.apache.cxf.jaxrs.provider.json.JSONProvider.dropRootElement
>> =
>>>>>> true
>>>>>>      org.apache.cxf.jaxrs.provider.json.JSONProvider.supportUnwrapped
>>>> =
>>>>>> true
>>>>>> 
>>>>>> openejb.xml
>>>>>>      <Service id="json"
>>>>>> class-name="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>>              dropRootElement = true
>>>>>>              supportUnwrapped = true
>>>>>>      </Service>
>>>>>> 
>>>>>> I set the last thing to a <Service/> as I noticed in the link
>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>> http://openejb.979440.n4.nabble.com/Configuring-Apache-CXF-in-TomEE-td4660207.html
>>>>>> 
>>>>>> you stated (at the end) to change <Resource/> to <Service/>.
>>>>>> 
>>>>>> Either way I still can't get it to work.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> So here is the github link to the app:
>>>>>> 
>>>>>> https://github.com/ChrisChristo/testing-rest-config.git
>>>>>> 
>>>>>> The process for building/running is as follows:
>>>>>> 
>>>>>> 1) mvn package -DskipTests
>>>>>> 
>>>>>> 2) manually copy target/testing-rest-config-0.0.1-SNAPSHOT.jar to
>>>>>> apache-openejb-4.6.0-SNAPSHOT/apps
>>>>>> 
>>>>>> 3) sh apache-openejb-4.6.0-SNAPSHOT/bin/openejb start
>>>>>> 
>>>>>> I then use curl to as follows:
>>>>>> 
>>>>>> curl -X POST -d @src/main/resources/custom_data.json
>>>>>> 
>>>> 
>> http://127.0.0.1:4204/testing-rest-config-0.0.1-SNAPSHOT/example/postDataCustom-H"Content-Type:
>> application/json" -v
>>>>>> 
>>>>>> and
>>>>>> 
>>>>>> curl -X POST -d @src/main/resources/custom_data_no_root.json
>>>>>> 
>>>> 
>> http://127.0.0.1:4204/testing-rest-config-0.0.1-SNAPSHOT/example/postDataCustom-H"Content-Type:
>> application/json" -v
>>>>>> 
>>>>>> The first one works but the second one (which uses the
>>>>>> custom_data_no_root.json) doesn't and this is the one I want to work,
>>>> but
>>>>>> without the dropRootElelement and the supportUnwrapped set to true
it
>>>> won't
>>>>>> work.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Chris Christo
>>>>>> 
>>>>>> ---
>>>>>> Twitter: https://twitter.com/ChrisChristo7
>>>>>> Tumblr: http://chrischristo7.tumblr.com
>>>>>> LinkedIn: http://uk.linkedin.com/in/chrischristo
>>>>>> GitHub: https://github.com/ChrisChristo
>>>>>> 
>>>>>> On 7 Jun 2013, at 13:10, Romain Manni-Bucau <rmannibucau@gmail.com>
>>>> wrote:
>>>>>> 
>>>>>>> global property cxf.jaxrs.providers should support it using json
as
>>>> value
>>>>>>> 
>>>>>>> if not please check it doesn't work on the snapshot then if so
>> provide
>>>>>> us a
>>>>>>> sample buildable and reproducing the issue
>>>>>>> 
>>>>>>> *Romain Manni-Bucau*
>>>>>>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>>>>>>> *Blog: **http://rmannibucau.wordpress.com/*<
>>>>>> http://rmannibucau.wordpress.com/>
>>>>>>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>>>>>> *Github: https://github.com/rmannibucau*
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 2013/6/7 Chris.Christo <chris.christo@mail.com>
>>>>>>> 
>>>>>>>> Hi Romain,
>>>>>>>> 
>>>>>>>> I was targeting openejb.xml (and/or system.properties and/or
>>>>>>>> conf.d/cxf-rs.properties) for a global config of the openejb
server
>>>> and
>>>>>> not
>>>>>>>> openejb-jar.xml which is specifically for one ejb jar (notice
I'm
>>>>>> referring
>>>>>>>> to the xml without the '-jar' part).
>>>>>>>> 
>>>>>>>> Chris Christo
>>>>>>>> 
>>>>>>>> ---
>>>>>>>> Twitter: https://twitter.com/ChrisChristo7
>>>>>>>> Tumblr: http://chrischristo7.tumblr.com
>>>>>>>> LinkedIn: http://uk.linkedin.com/in/chrischristo
>>>>>>>> GitHub: https://github.com/ChrisChristo
>>>>>>>> 
>>>>>>>> On 7 Jun 2013, at 13:03, Romain Manni-Bucau <rmannibucau@gmail.com>
>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> <Resource id="json" class-name="org.apache.cxf.jaxrs.provider.json.
>>>>>>>>> JSONProvider">
>>>>>>>>>   dropRootElement = true
>>>>>>>>>   supportUnwrapped = true
>>>>>>>>> </Resource
>>>>>>>>> 
>>>>>>>>> works fine when setting the providers in openejb-jar.xml
>>>>>>>>> 
>>>>>>>>> *Romain Manni-Bucau*
>>>>>>>>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>>>>>>>>> *Blog: **http://rmannibucau.wordpress.com/*<
>>>>>>>> http://rmannibucau.wordpress.com/>
>>>>>>>>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>>>>>>>> *Github: https://github.com/rmannibucau*
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 2013/6/7 Chris.Christo <chris.christo@mail.com>
>>>>>>>>> 
>>>>>>>>>> Hi guys,
>>>>>>>>>> 
>>>>>>>>>> Quick question, How can I get the following properties
applied to
>>>>>>>> jax-rs?
>>>>>>>>>> dropRootElement = true
>>>>>>>>>> supportUnwrapped = true
>>>>>>>>>> I saw this post
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> http://openejb.979440.n4.nabble.com/Configuring-Apache-CXF-in-TomEE-td4660207.html
>>>>>>>>>> 
>>>>>>>>>> which outlines how to do it with an openejb-jar.xml
and a
>>>>>> resources.xml,
>>>>>>>>>> but how can I do it with just system.properties and/or
>> openejb.xml?
>>>>>>>>>> 
>>>>>>>>>> I've tried things like:
>>>>>>>>>> 
>>>>>>>>>> openejb.jaxrs.providers.auto=true
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> openejb.cxf.jax-rs.providers=org.apache.cxf.jaxrs.provider.json.JSONProvider
>>>>>>>>>> org.apache.cxf.jaxrs.provider.json.JSONProvider.dropRootElement
=
>>>> true
>>>>>>>>>> org.apache.cxf.jaxrs.provider.json.JSONProvider.supportUnwrapped
=
>>>>>> true
>>>>>>>>>> 
>>>>>>>>>> also tried this in openejb.xml
>>>>>>>>>> 
>>>>>>>>>> <Resource id="json"
>>>>>>>>>> class-name="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>>>>>>>>   dropRootElement = true
>>>>>>>>>>   supportUnwrapped = true
>>>>>>>>>> </Resource>
>>>>>>>>>> 
>>>>>>>>>> but no to avail.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Chris Christo
>>>>>>>>>> 
>>>>>>>>>> ---
>>>>>>>>>> Twitter: https://twitter.com/ChrisChristo7
>>>>>>>>>> Tumblr: http://chrischristo7.tumblr.com
>>>>>>>>>> LinkedIn: http://uk.linkedin.com/in/chrischristo
>>>>>>>>>> GitHub: https://github.com/ChrisChristo
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>> 
>> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message