Sorry, my mail got cut in the middle.

So, you should place @Consumes annotation in REST Resource + all that
Spring config explained here:
https://cocoon.apache.org/3.0/reference/html-single/index.html#webapps.rest

AND

JSONProvider in spring config:
<bean id="jsonProvider"
class="org.apache.cxf.jaxrs.provider.json.JSONProvider" > <property
name="singleJaxbContext" value="true" /> <property name="extraClass">
<list> <value>package.to.class.Order</value> </list> </property> </bean>

This one is from Apache CXF but you can use any other (e.g. from Jersey).

Hope this helps.

Greetings,
Greg


2014-03-17 19:57 GMT+01:00 gelo1234 <gelo1...@gmail.com>:

> Hi Bardo,
>
> Are you talking about REST in C3 (cocoon-rest dependency) ?
>
> Have you tried annotating REST Resource with:
>
> @Consumes(MediaType.APPLICATION_JSON)
>
> ?
>
> e.g.
>
> @Path("/orders")
> @Consumes(MediaType.APPLICATION_JSON)public class OrderRestResource {         
>                                                [image: (2)]
>
>     private Settings settings;
>
> private static Map<Integer, Order> orders = new HashMap<Integer, Order>();
>
>     @POST
>     public void createOrder(Order order) {
>         orders.put(order.id, order);
>     }
>
> }
>
>
>
>
>
> 2014-03-16 20:36 GMT+01:00 Bardo Nelgen <
> mailing.list.in...@bnnperformances.de>:
>
>
>> Hi all,
>>
>> has someone ever accessed the message body of a post request to cocoon
>> which uses application/json as its content type?
>>
>> The same request is being handled without issues if posted as
>> application/x-www-form-urlencoded.
>>
>> Though, as soon as the content type is changed to JSON, Cocoon appears to
>> skip parsing the message body.
>>
>> Unfortunately it's not me making these POST calls; which is why just
>> "switching it" is not an option.
>>
>> Is there some setting which can tell cocoon to simply continue parsing,
>> either regardless of a post's content type (which, of course might raise
>> security issues...) or explicitly for application/json ?
>>
>> Any suggestions are welcome.
>>
>> Regards,
>>
>> Bardo
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
>> For additional commands, e-mail: users-h...@cocoon.apache.org
>>
>>
>

Reply via email to