I'm trying to use the JAXRSBeanValidationOutInterceptor with a customized
ValidationExceptionMapper but it throws a Fault when processing instead of
returning a response with the violations.

Here is the scenario:
When a Response is built with an entity object that has violations, the
interceptor correctly runs and throws the
ResponseConstraintViolationException with the list of violations.  This is
then handled by the ValidationExceptionMapper which builds another Response
object with a different object for the entity object (our API error object). 
That in turn is also sent through the same set of outbound interceptors
causing the validation to run again.  When the validation is run again, in
the AbstractValidationInterceptor.handleMessage method the code gets the
MessageContentsList to pass to the handleValidation method.

Problem:  The MessageContentsList contains the first entity from the initial
Response instead of the new entity from the new Response.  Since I don't
have direct access to the Message object, I don't think I can affect the
MessageContentsList.  What finally ends up happening is an internal CXF
Fault is thrown instead the response that contains the violations.

Other details:
I set BeanValidationOutInterceptor.enforceOnlyBeanConstraints to true
The order of the interceptors is:  (there are other mappers/filters but
after stepping through the code, I don't think they have any effect here)

How do I affect the MessageContentsList to return the new entity so the
validation can run on the new object instead of the one that already failed?



View this message in context: 
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to