Yes that's probably what I will try to use. I only wonder if there is maybe something out of the box?
> On 01 Apr 2014, at 21:59, William Antônio Siqueira > <william.a.sique...@gmail.com> wrote: > > Hello, > > have you thought about using an interceptor? > > -- > William Antônio Siqueira > Java Support Analyst > > http://fxapps.blogspot.com > http://www.williamantonio.wordpress.com > http://williamprogrammer.com > > > 2014-04-01 15:35 GMT-03:00 Marcel Overdijk <marceloverd...@gmail.com>: >> >> >> >> I have a (Groovy) resteasy resource like: >> >> @POST >> @Consumes(MediaType.APPLICATION_JSON) >> @Produces(MediaType.APPLICATION_JSON) >> def create(CustomerRequestBody body) { >> def customer = new Customer() >> bindData(customer, body) >> def violations = validate(customer) >> if (violations) { >> return >> Response.status(BAD_REQUEST).entity(toJSONArray(violations)).build() >> } else { >> customer.save() >> return Response.status(OK).entity(toJSONObject(customer)).build() >> } >> } >> >> The resource only accepts json requests. >> The CustomerRequestBody is a simple POJO (or POGO in my case). >> >> When I post a empty response to the this resource (even with content type >> set to json) I would expect a 415 unsupported media type. >> >> However the actual is that the request ends up in the resource but the >> CustomerRequestBody body variable is null. >> >> What is the best way to globally disallow the payload to be empty and return >> a 415? >> Note that sending {} to the resource works as expected and the >> CustomerRequestBody body variable is not empty; only it's properties are >> empty as expected. >> >> >> Cheers, >> Marcel >> >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> Resteasy-users mailing list >> Resteasy-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/resteasy-users >
------------------------------------------------------------------------------
_______________________________________________ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users