You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2011/08/29 19:28:38 UTC

[jira] [Resolved] (CXF-3760) Problematic inheritance of @Produces/@Consumes

     [ https://issues.apache.org/jira/browse/CXF-3760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-3760.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.5
                   2.4.3
                   2.3.7
         Assignee: Sergey Beryozkin

I made a minor update which should get it fixed - please check with 2.4.3-SNAPSHOT when you get a chance

> Problematic inheritance of @Produces/@Consumes
> ----------------------------------------------
>
>                 Key: CXF-3760
>                 URL: https://issues.apache.org/jira/browse/CXF-3760
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.4.2
>            Reporter: Marco Schulte
>            Assignee: Sergey Beryozkin
>             Fix For: 2.3.7, 2.4.3, 2.5
>
>
> Given the sample interface invoiceWebservice:
> {code} 
> @Path("invoice/")
> @Consumes(MediaType.APPLICATION_XML)
> @Produces(MediaType.APPLICATION_XML)
> public interface InvoiceWebservice {
> 	@POST
> 	public void insert(WSInvoice wsInvoice);
> 	[...]
> }
> {code} 
> The usage of insert of this sample interface will cause an error, if used as both client and server interface.
> The client will send the http header "Accept: text/plain" due to return type void of insert(WSInvoice). But the server will respond with http "406 not acceptable", because the method inherited @Produces(MediaType.APPLICATION_XML).
> A workaround is to only annotate the methods, so insert does not get an @Produces annotation, or adding "text/plain" to @Consumes.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira