Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Registering custom json provider for user model resources

$
0
0
Hi,
I have the following case:
I have an annotated resource which is registered as resource into the
singletons of my Application on a specific alias. I wanted to expose only
parts of this resource to a different alias, so what I did is that I
exposed the methods of the resource I wanted as an user model (as descibed
here:
http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX-RSAdvancedFeatures-RESTfulserviceswithoutannotations)
. Which worked just fine, I mean the resource gets registered, invoked
successfully and so on, however when returning response I got http response
500.

The only clue I saw in the logs was:
2013 07 06
12:36:35#+0300#WARN#org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor##anonymous#http-bio-8443-exec-28###No
message body writer has been found for response class Vector.

So after a bit more debugging I noticed that my messageWriters are empty,
i.e. my custom Gson json provider is not taken into consideration and
therefor it cannot serialize the response to json. My custom json provider
is injected with @Provider annotation(I'm not using spring) and works
perfectly fine when I invoke the very same method but through my other
alias.

So, is there a way to point the json provider for resource registered as
resources without annotations?

Big Thanks in advance.

Regards,
Kiril

Viewing all articles
Browse latest Browse all 5648

Trending Articles