cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gelo1234 <gelo1...@gmail.com>
Subject Re: Accessing application/json message body of POST request
Date Mon, 17 Mar 2014 18:57:37 GMT
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.inbox@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-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Mime
View raw message