users@jersey.java.net

Returning XML validation failure info in responses

From: Brian Buderman <b.buderman_at_gmail.com>
Date: Tue, 13 Apr 2010 13:12:49 -0400

Hi,

I see how to register a ContextResolver<Unmarshaller> such that an
unmarshaller is created with a schema to validate against. The
validation then occurs during POST/PUT, and does fail, throwing an
UnmarshalException with a linked SAXParseException. It seems the
Jersey server code then catches that, and turns it into a
WebApplicationException with response code 400.

What would be the recommended way to propagate the details from
SAXParseException into the response? Registering an ExceptionMapper
doesn't seem proper as the error is wrapped in a
WebApplicationException.

I've tried using Jersey 1.0.3 and 1.1.5.1, with JAXB 2.1.12.

Thanks in advance.