cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose MarĂ­a Zaragoza <>
Subject Format message returned by REST service after schema-validation
Date Mon, 10 Feb 2014 09:36:09 GMT

I'm using Apache CXF 2.7.3 and JAX-RS to deploy a REST webservice.
The format of messages is only JSON

I've enabled schema-validation and response looks like

Response-Code: 400
Content-Type: text/plain
Headers: {Content-Type=[text/plain], Date=[Mon, 10 Feb 2014 09:25:19 GMT]}
Payload: JAXBException occurred : cvc-pattern-valid: Value 'xxxxxxxx'
is not facet-valid ...

I would like to capture this exception and format the payload
I tried this CustomOutInterceptor

but it doesn't work for me: message content never is an exception My
CustomOutInterceptor is invoked but it doesn't receive an exception
despite of an exception is thrown
in server side.

10:25:19.823 [http-8080-3] WARN  [AbstractJAXBProvider]
[handleExceptionStart] - javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException: cvc-pattern-valid: Value 'xxxxx' is
not facet-valid

any ideas ? any example ?


View raw message