You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2016/07/25 15:40:20 UTC

[jira] [Updated] (CXF-6870) CXF doesn't check the message body's generic type

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

Daniel Kulp updated CXF-6870:
-----------------------------
    Fix Version/s:     (was: 3.0.10)
                       (was: 3.1.7)
                       (was: 3.2.0)

> 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
>         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)