Hi Akos, it should work now with the latest snapshot. Cheers, Jervis
> -----Original Message----- > From: Liu, Jervis [mailto:[EMAIL PROTECTED] > Sent: 2008年1月8日 16:12 > To: [email protected] > Subject: RE: using multiple values for @ProduceMime > > Hi Akos, you definitely should be able to set multiple values for > @ProduceMime. According to spec, if @ProduceMime contains multiple > MIME types (or it’s a wild card such as "*/*"), the actual output content > type being used is determined by: > > 1. the output Java type: i.e., if your method is declared as: > @HttpMethod("GET") > @UriTemplate("/books/{bookId}/") > @ProduceMime("application/xml, "application/json") > public Book getBook (@UriParam("bookId") String id) throws > BookNotFoundFault { > ... > } > > The EntityProvider under consideration (JAXBElementProvider or > JSONEntityProvider) must support the Book type. In CXF, if your Book class is > declared with @XmlRootElement annotation, both JAXBElementProvider or > JSONEntityProvider's supports() method will return true > > 2. The Accepted header. > > 3. If there are still multiple EntityProvider selected after step 1 and 2 > (EntityProvider is used to produce output), the first one in the candidate > list > is selected. The candidate list is sorted using " x/y < x/* < */*". > > In your case, if your client did not set accepted header, "application/json" > should be selected, I guess there is a bug that did not set output MIME type > correctly. I will fix this. Jira created: > https://issues.apache.org/jira/browse/CXF-1361 > > Cheers, > Jervis > > > > -----Original Message----- > > From: ákos Maróy [mailto:[EMAIL PROTECTED] > > Sent: 2008年1月7日 20:37 > > To: [email protected] > > Subject: using multiple values for @ProduceMime > > > > Hi, > > > > I'm experimenting with the JAX-RS implementation in CXF. I'm trying to > > create methods that are able to return content in different formats. The > > JAX-RS spec says that any method can declare multiple MIME types that it > > produces, like: > > > > @ProduceMime({"application/xml", "application/json"}) > > > > > > but when trying this out, I see that the CXF implementation effectively > > only allows for a single MIME type declaration. If I declare multiple > > entries, like above, strangely the returned MIME type will be > > application/xml, but the returned format will be application/json > > > > I wonder if it's possible to make this feature work in CXF as in the spec? > > > > > > Akos > > ---------------------------- > IONA Technologies PLC (registered in Ireland) > Registered Number: 171387 > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland ---------------------------- IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
