Neal Hu created CXF-6870: ---------------------------- Summary: 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.0.9, 3.1.6, 3.1.3 Environment: mac, windows Reporter: Neal Hu Fix For: 3.0.10, 3.1.7, 3.2.0
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)