Hi
In CXF 2.7.3 you should use JAX-RS ExceptionMapper,
On 10/02/14 09:36, Jose María Zaragoza wrote:
Hello:
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
http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutFaultInterceptor.java
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
Do you mean you custom out fault interceptor is not even invoked ?
Register it in jaxrs:outFaultInterceptors, you should get it invoked,
but try the exception mappers if you can
Sergey
any ideas ? any example ?
Regards