I just had a chance to look a little closer at this. It appears that
when we use the CXF servlet transport the mime types for the "Accept:" &
"Content-Type:" headers are not being propagated into the jax-rs
runtime. I'm currently investigating why this is the case.

BTW I was mistaken on the ProduceMime thing yesterday, you can specify
multiple mime types in the @ProduceMime annotation, you simply need to
encose the array of strings in curly braces like the following:
  @ProduceMime({"application/xml", "application/json"})
duh! ;)
--Frank



On Wed, 2008-01-23 at 14:33 -0500, Frank Lynch wrote:
> I'm seeing the same thing here, no matter what I do the runtime seems to
> want to dispatch the call to the method annotated application/json. I
> also noted that it isn't possible to annotate a single method with
> multiple mime types. i.e. per the dec4th jsr311 draft it should be
> possible t0 annotate a method with the following:
>   @ProduceMime("application/xml", "application/json")
> alas, this doesn't appear to be supported in cxf yet. I guess we should
> log JIRA's for these.
> --Frank
> 
> On Wed, 2008-01-23 at 07:12 -0800, brmaguir wrote:
> > Hi,
> > 
> > Does CXF support the JSR311 @ProduceMime annotation fully? Here's the code:
> > 
> > import com.sun.ws.rest.api.ConsumeMime;
> > import com.sun.ws.rest.api.HttpMethod;
> > import com.sun.ws.rest.api.ProduceMime;
> > import com.sun.ws.rest.api.UriTemplate;
> > 
> > @UriTemplate("/sampleservlet")
> > public class SampleServlet {
> >     
> >     @HttpMethod("PUT")
> >     @ConsumeMime("text/plain")
> >     @ProduceMime("application/xml")
> >     public void getXML() {
> >             System.out.println("### Handle PUT for sampleservlet: XML ###");
> >     }
> >     
> >     @HttpMethod("PUT")
> >     @ConsumeMime("text/plain")
> >     @ProduceMime("application/json")
> >     public void getJSON() {
> >             System.out.println("### Handle PUT for sampleservlet: JSON 
> > ###");
> >     }
> > }
> > 
> > When the client specifies the Accept parameter in the http header as
> > application/json or application/xml I would expect the corresponding method
> > to be called according to the @ProduceMime specified before the method. Is
> > this supported? It doesn't seem to be working as expected for me.
> > 
> > Thanks in advance.

Reply via email to