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

Daniel Kulp reassigned CXF-1431:
--------------------------------

    Assignee:     (was: Daniel Kulp)

> Error in the JAX-RS implementation for matching method types to Accept Header
> -----------------------------------------------------------------------------
>
>                 Key: CXF-1431
>                 URL: https://issues.apache.org/jira/browse/CXF-1431
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1
>            Reporter: Barry Fitzgerald
>             Fix For: 2.1
>
>
> Consider the following scenario:
> I have a resource with 2 methods:
> @HttpMethod("GET")
> @UriTemplate("/users/{id}")
> @ProduceMime("text/xml")
> public Response getUser(@UriParam("id") String id) throws Exception { ....}
> @HttpMethod("GET")
> @UriTemplate("/users/{id}")
> @ProduceMime("application/json")
> public Response getUserJSON(@UriParam("id") String id) throws Exception { 
> ....}
> If I then send a request to /users/24 with Accept headers of  "text/xml, */*" 
> one would expect the "text/xml" method to be invoked. However in the CXF 
> implementation the application/json one is invoked. Suggest changing the 
> algorithm to:
> 1. Sort the Accept header according to the W3 standards
> 2. Iterate through the accept header list. For each one:
>         1. Find all matching methods
>         2. If there is only one method return this and break out of the 
> accept header loop
>         3. If there are multiple methods sort these methods using consume 
> mime and produce mime. Then return the first

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to