Hi,
On 02/05/12 12:43, Govindaram PS wrote:
I have a service which takes request body in Json format.
It is working fine when request body is in proper Json format.

When the request body has wrong data, CXF is throwing 500(Internal server
error) response.

The reason is readFrom api in JsonProvider is throwing default
WebApplicationError in case of exception.
http://svn.apache.org/repos/asf/cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java


I want to throw 400(Bad request) in this case.

This was fixed for JAXB providers. Actually, I see JSONProvider also reports 400 for JAXBExceptions. What is the original exception ? I think I need to fix the XMLStreamException handler, it's obviously reported in case of broken payloads too

What is the best way to achieve this?

Register your own WebApplicationException mapper and report 400

HTH, Sergey


Thanks,
Govind



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to