You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jose María Zaragoza <de...@gmail.com> on 2013/03/11 21:37:15 UTC

JAX-RS and @Consumes/@Produces annotations

Hello:

We're using Apache CXF 2.7.3

I would like if it's possible to configure media-types of a REST
service in Spring context file (bean.xml)

I would like to declare into <jaxrs:server/>  which media-types accepts
I'm not saying to add custom providers to process message by  its
media-type, but to declare "all this service consumes/produces these
media types"

Thanks and regards

Re: JAX-RS and @Consumes/@Produces annotations

Posted by Jose María Zaragoza <de...@gmail.com>.
Hi

2013/3/12 Sergey Beryozkin <sb...@gmail.com>:
> Hi
>
> I guess what you'd like to do is to avoid adding the annotations but provide
> some external info describing the resources, if so, then working with a user
> model is what will do:
>
> http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX-RSAdvancedFeatures-RESTfulserviceswithoutannotations
>

Interesting.
Thanks and regards !

Re: JAX-RS and @Consumes/@Produces annotations

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 11/03/13 20:37, Jose María Zaragoza wrote:
> Hello:
>
> We're using Apache CXF 2.7.3
>
> I would like if it's possible to configure media-types of a REST
> service in Spring context file (bean.xml)
>
> I would like to declare into<jaxrs:server/>   which media-types accepts
> I'm not saying to add custom providers to process message by  its
> media-type, but to declare "all this service consumes/produces these
> media types"
>
I guess what you'd like to do is to avoid adding the annotations but 
provide some external info describing the resources, if so, then working 
with a user model is what will do:

http://cxf.apache.org/docs/jax-rs-advanced-features.html#JAX-RSAdvancedFeatures-RESTfulserviceswithoutannotations

You can create a model as an external resource and then link to it from 
jaxrs:server with a modelRef attribute.

You can combine that with registering service beans, so the model can 
refer to interfaces and then you can have the implementations registered 
as service beans which possibly provide more info like @Path, etc, or 
the model can refer to the actual implementations...

HTH, Sergey

> Thanks and regards