You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2015/08/18 22:19:51 UTC
Re: Can't Get Jackson jaxrs:providers Working!!!
Well, is your custom provider selected ?
Looks like you have 2 json providers. If you keep a custom provider
only, what happens ?
Sergey
On 18/08/15 20:40, craigrs84 wrote:
> I have the following setup, I'm trying to use Jackson Json provider with
> custom settings applied.
>
> However whenever I connect to my service the customizations are NOT applied.
> For example it still wraps the root element and doesn't indent the JSON.
> (see code below for explanation)
>
> I'm getting desperate, please respond with advice. Thanks.
>
>
> <jaxrs:server id="textingService" address="/texting">
>
> <jaxrs:serviceBeans>
> <bean class="com.vectren.ws.rest.TextingService"/>
> </jaxrs:serviceBeans>
>
> <jaxrs:providers>
> <ref bean="jsonProvider"/>
> <ref bean="jaxbJsonProvider"/>
> </jaxrs:providers>
>
> </jaxrs:server>
>
> public class CustomJsonProvider extends
> com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider
> {
> public CustomJsonProvider()
> {
> super();
> super.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
> super.configure(SerializationFeature.INDENT_OUTPUT, true);
> }
> }
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Can-t-Get-Jackson-jaxrs-providers-Working-tp5760269.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Can't Get Jackson jaxrs:providers Working!!!
Posted by Sergey Beryozkin <sb...@gmail.com>.
The latest version of CXF ? That would explain it why having Jettison
was affecting it.
In earlier CXF if the custom provider was matching then the default
providers were not checked. It proved to be not spec compliant, as the
spec does require both default and custom providers being considered as
candidates, even if the matching custom provider is available.
So we have Jettison based provider, typed by Object but is also having
Consumes/Produces application/json, etc
and Jackson, also typed by Object but using wildcard media types.
therefore Jettison based provider wins using a media type selection criteria
HTH, Sergey
On 18/08/15 22:06, craigrs84 wrote:
> 1. Removing jettison from the classpath fixed the problems!
> 2. I'm running the latest version of CXF
> 3. Sorry, I'm not sure how to migrate this into the Users list other than
> re-creating a new thread, is that what you mean?
>
> It seems that the jettison provider was overriding the jackson provider I
> had configured in my spring xml file. Is that normal or a bug? It feels
> like my jackson provider should have overridden the jettison provider based
> on the spring config.
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Can-t-Get-Jackson-jaxrs-providers-Working-tp5760269p5760277.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Can't Get Jackson jaxrs:providers Working!!!
Posted by Sergey Beryozkin <sb...@gmail.com>.
The latest version of CXF ? That would explain it why having Jettison
was affecting it.
In earlier CXF if the custom provider was matching then the default
providers were not checked. It proved to be not spec compliant, as the
spec does require both default and custom providers being considered as
candidates, even if the matching custom provider is available.
So we have Jettison based provider, typed by Object but is also having
Consumes/Produces application/json, etc
and Jackson, also typed by Object but using wildcard media types.
therefore Jettison based provider wins using a media type selection criteria
HTH, Sergey
On 18/08/15 22:06, craigrs84 wrote:
> 1. Removing jettison from the classpath fixed the problems!
> 2. I'm running the latest version of CXF
> 3. Sorry, I'm not sure how to migrate this into the Users list other than
> re-creating a new thread, is that what you mean?
>
> It seems that the jettison provider was overriding the jackson provider I
> had configured in my spring xml file. Is that normal or a bug? It feels
> like my jackson provider should have overridden the jettison provider based
> on the spring config.
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Can-t-Get-Jackson-jaxrs-providers-Working-tp5760269p5760277.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Can't Get Jackson jaxrs:providers Working!!!
Posted by craigrs84 <cs...@kellerschroeder.com>.
1. Removing jettison from the classpath fixed the problems!
2. I'm running the latest version of CXF
3. Sorry, I'm not sure how to migrate this into the Users list other than
re-creating a new thread, is that what you mean?
It seems that the jettison provider was overriding the jackson provider I
had configured in my spring xml file. Is that normal or a bug? It feels
like my jackson provider should have overridden the jettison provider based
on the spring config.
--
View this message in context: http://cxf.547215.n5.nabble.com/Can-t-Get-Jackson-jaxrs-providers-Working-tp5760269p5760277.html
Sent from the cxf-dev mailing list archive at Nabble.com.
Re: Can't Get Jackson jaxrs:providers Working!!!
Posted by Sergey Beryozkin <sb...@gmail.com>.
Make sure please it is targeted to the users list.
Can you confirm you provider is not called by debugging ? Example,
override isReadable/isWriteable and put breakpoints there ?
The default jettison provider can only be called if you have jettison
available on the classpath - make sure it is not, CXF does not add it
itself, may be in very old CXF versions only.
Finally, early CXF 2.7.x could not support Jackson 2.x
Please investigate
Sergey
On 18/08/15 21:36, craigrs84 wrote:
> Please see edited post, I've edited code so that it is only one provider.
>
> Same result. It seems like it's using the built in CXF provider rather than
> the Jackson based provider.
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Can-t-Get-Jackson-jaxrs-providers-Working-tp5760269p5760274.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Can't Get Jackson jaxrs:providers Working!!!
Posted by Sergey Beryozkin <sb...@gmail.com>.
Make sure please it is targeted to the users list.
Can you confirm you provider is not called by debugging ? Example,
override isReadable/isWriteable and put breakpoints there ?
The default jettison provider can only be called if you have jettison
available on the classpath - make sure it is not, CXF does not add it
itself, may be in very old CXF versions only.
Finally, early CXF 2.7.x could not support Jackson 2.x
Please investigate
Sergey
On 18/08/15 21:36, craigrs84 wrote:
> Please see edited post, I've edited code so that it is only one provider.
>
> Same result. It seems like it's using the built in CXF provider rather than
> the Jackson based provider.
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Can-t-Get-Jackson-jaxrs-providers-Working-tp5760269p5760274.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Can't Get Jackson jaxrs:providers Working!!!
Posted by craigrs84 <cs...@kellerschroeder.com>.
Please see edited post, I've edited code so that it is only one provider.
Same result. It seems like it's using the built in CXF provider rather than
the Jackson based provider.
--
View this message in context: http://cxf.547215.n5.nabble.com/Can-t-Get-Jackson-jaxrs-providers-Working-tp5760269p5760274.html
Sent from the cxf-dev mailing list archive at Nabble.com.