3

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.

bdoughan
  • 147,609
  • 23
  • 300
  • 400
joshjdevl
  • 7,092
  • 12
  • 45
  • 57
  • Check out my answer to a similar question, it involves creating a MessageBodyReader: - http://stackoverflow.com/questions/3428273/validate-jaxbelement-in-jpa-jax-rs-web-service/3440388#3440388 – bdoughan Oct 08 '10 at 13:56

1 Answers1

-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.

yegor256
  • 102,010
  • 123
  • 446
  • 597