users@jersey.java.net

Re: [Jersey] Returning XML validation failure info in responses

From: Marc Hadley <marc.hadley_at_oracle.com>
Date: Tue, 13 Apr 2010 15:35:37 -0400

On Apr 13, 2010, at 1:12 PM, Brian Buderman wrote:
>
> 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.
>
What happens if you include an ExceptionMapper for UnmarshalException ?

Marc.