POST sub-resource with optional payload

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

POST sub-resource with optional payload

kdford
I have a POST sub-resource at the moment which consumes application/json and has a payload that is a custom POJO.

I have the need to make that payload optional.  I can of course specify a payload of {} but that is not what I want.  I would like my user to be able to invoke the method without a payload at all.  I created a new method with an identical @Path annotation but a different method signature which did not do what I wanted, it still routed to the method with the POJO payload, which of course failed deserialization with EOF because there was no payload.

Jersey has something called an EntityHolder<CustomType> for this purpose but I could not find a Wing analog to this.

Any help would be appreciated.