[ 
https://issues.apache.org/jira/browse/CXF-6870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15245422#comment-15245422
 ] 

Neal Hu commented on CXF-6870:
------------------------------

I checked RI, which has not deal with generic type of the Providers' and 
message body's.
Deal with the matching logic of Provider's and message body's generic type will 
be very complex.




> CXF doesn't check the message body's generic type
> -------------------------------------------------
>
>                 Key: CXF-6870
>                 URL: https://issues.apache.org/jira/browse/CXF-6870
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.3, 3.1.6, 3.0.9
>         Environment: mac, windows
>            Reporter: Neal Hu
>             Fix For: 3.0.10, 3.1.7, 3.2.0
>
>         Attachments: ListAProvider.java, ListBProvider.java, Resource.java, 
> beans.xml
>
>
> CXF doesn't check the message body's generic type, please see the sample 
> below.
> {code:java}
> public class ListAProvider implements MessageBodyWriter<List<String>> 
> public class ListBProvider implements MessageBodyWriter<List<Integer>> 
> resource class:
>       @GET
>       @Path("/echo/{param}")
>       @Produces("application/json")
>       public List<String> echo(@PathParam("param")String name){
>               List<String> list = new ArrayList<String>();
>               list.add("hello");
>               list.add(name);
>               return list;
>       }
>       
>       @GET
>       @Path("/echo2/{param}")
>       @Produces("application/json")
>       public List<Integer> echo2(@PathParam("param")String name){
>               List<Integer> list = new ArrayList<Integer>();
>               list.add(1);
>               list.add(2);
>               return list;
>       }
> {code}
> No matter you request echo or echo2 resource method, the selected provider is 
> ListBProvider



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to