cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin" <sbery...@progress.com>
Subject Re: Selecting default media type [@ProduceMime]
Date Wed, 18 Feb 2009 11:34:49 GMT
Your're welcome, sorry for my regular portion of typos :-)

----- Original Message ----- 
From: "CXFbanda" <chetanha@nortel.com>
To: <users@cxf.apache.org>
Sent: Wednesday, February 18, 2009 11:28 AM
Subject: Re: Selecting default media type [@ProduceMime]


> 
> Sergey, thanks a lot for the help.
> 
> 
> Sergey Beryozkin-2 wrote:
>> 
>> Hi
>> 
>> In 2.1.3 JAXBElementProvider has a woildcard support so if you register it
>> explicitly then it will always be checked first and it 
>> will 'swallow' the json requests too as the types will be JAXB annotated.
>> If you'd like to avoid writing a filter then the other simple way is to
>> just extend JAXBElementProvider and add explicit 
>> ProducesMine and ConsumesMime and then register your custom provider.
>> For 2.2 I'll also tro to ensure that JAXB provider is selected by default
>> for wildcards without users having to do some additional 
>> condiguration. Perhaps I can introduce a quality factor 0.9 for types
>> consumed by JSONProvider...
>> In 2.1.4 you can also explcitly configure the consume/produce types from
>> Spring, but in 2.1.3 it's either a custom provider or 
>> filter which will help...
>> 
>> Cheers, Sergey
>> 
>> 
>> 
>>>
>>> Thanks for the reply Sergey.
>>> I'm currently using CXF 2.1.3
>>> As u said, filters can be one of my solutions.
>>> (And i'll try that out.)
>>> However, I'm looking for a more direct way to set my default provider.
>>> Does CXF (2.1.3) has no support for doing this?
>>>
>>>
>>> Sergey Beryozkin-2 wrote:
>>>>
>>>> Or you can try to use _type=xml query if possible, or write
>>>> RequestFilter which will check if it's */* and if yes then replace
>>>> Message Accept value with application/xml
>>>>
>>>> Cheers, Sergey
>>>>
>>>> -----Original Message-----
>>>> From: Sergey Beryozkin [mailto:sberyozk@progress.com]
>>>> Sent: 17 February 2009 14:33
>>>> To: users@cxf.apache.org
>>>> Subject: RE: Selecting default media type [@ProduceMime]
>>>>
>>>> Hi
>>>>
>>>> In CXF 2.1.3 JAXB provider is considered less specific as it has no
>>>> explicit ProduceMime/ConsumeMime values. In 2.1.4 you can explicitly
>>>> register JAXB provider
>>>> (org.apache.cxf.jaxrs.provider.JAXBElementprovider) and this will ensure
>>>> that Accept:*/* is mapped to JAXB...
>>>>
>>>> Cheers, Sergey
>>>>
>>>> -----Original Message-----
>>>> From: CXFbanda [mailto:chetanha@nortel.com]
>>>> Sent: 17 February 2009 13:34
>>>> To: users@cxf.apache.org
>>>> Subject: Selecting default media type [@ProduceMime]
>>>>
>>>>
>>>> Hi,
>>>> I have two methods in the resource class having
>>>> @ProduceMime("application/json")
>>>> &
>>>> @ProduceMime("application/xml")
>>>>
>>>> Any incoming request with header - Accept:*/* is being mapped to json by
>>>> default.
>>>> However, I require it to be xml.
>>>>
>>>> Anyway, I can do that?
>>>> I tried using @ProduceMime("*/*") on the 3rd method but still it's
>>>> invoking
>>>> json.
>>>>
>>>> Any help is appreciated.
>>>> Thanks
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/Selecting-default-media-type--%40ProduceMime--tp22
>>>> 057396p22057396.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Selecting-default-media-type--%40ProduceMime--tp22057396p22072715.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>> 
>> 
>> 
>> 
> 
> -- 
> View this message in context: http://www.nabble.com/Selecting-default-media-type--%40ProduceMime--tp22057396p22076762.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

Mime
View raw message