This is because CXF 2.3.0 (and Jettison 1.2) do not support reading explicit collections/arrays, thus Jettison provider return false from its isReadable
Please upgrade to 2.3.4 or 2.4.0. thanks, Sergey On Sun, May 1, 2011 at 6:01 AM, arnavawasthi <[email protected]> wrote: > Thanks, that worked. > > But now, if I want to post List of Customers in JSON in the following way: > > @POST > @Path("/addCustomers/") > @Consumes(MediaType.APPLICATION_JSON) > //{"Customer":[{"id":2999,"name":"Som Awasthi"},{"id":3000,"name":"Arnav > Awasthi"}]} > public List<Customer> addCustomers(List<Customer> list){ > logger.debug(list); > return list; > } > > Request Header: > Content-Type: application/json > > Request Body: > {"Customer":[{"id":2999,"name":"Som Awasthi"},{"id":3000,"name":"Arnav > Awasthi"}]} > > Again the "415: Unsupported Media Type" error. > > Input to this request is same, what I have got in the listCustomers call, > which is as follows: > > @GET > @Path("/listCustomers") > public List<Customer> listCustomers(){ > List<Customer> list = new ArrayList<Customer>(); > list.add(new Customer("Som Awasthi", 2999L)); > list.add(new Customer("Arnav Awasthi", 3000L)); > > return list; > } > > Regards, > Arnav-- > View this message in context: > http://cxf.547215.n5.nabble.com/How-to-submit-JSON-data-as-request-body-in-Apache-CXF-jax-rs-REST-tp4361669p4362318.html > Sent from the cxf-user mailing list archive at Nabble.com. > -- Sergey Beryozkin Application Integration Division of Talend http://sberyozkin.blogspot.com
