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
  • 145,155
  • 22
  • 291
  • 386
joshjdevl
  • 6,842
  • 12
  • 44
  • 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
  • 97,508
  • 114
  • 426
  • 573