JAX RS Jersey Schema Validation

2019-07-01 16:01发布

问题:

How to configure schema validation for JAX-RS RESTFul services?

We are using XSD to define the models, and JAXB to generate the java models.

回答1:

This is how it's done automatically in ReXSL: XslResolver#addXsdValidatorToMarshaller() (pay attention to the highlighted method). In a nutshell, you need to use setSchema() of your JAXB Marshaller.