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 <[email protected]> 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 <[email protected]>
>
>> 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 <[email protected]> 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 <[email protected]>
>>>
>>>> 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
>>>>
>>>>
>>
>>