开发者

JAXB and Entity Class validation

开发者 https://www.devze.com 2023-03-10 11:03 出处:网络
For a REST-Webservice i had to validate incomingData. Is is possible to 开发者_Go百科validate incoming data with an Entity Class and JAXB , instead of xsdBelow is a link of how you could validate Data

For a REST-Webservice i had to validate incoming Data. Is is possible to 开发者_Go百科validate incoming data with an Entity Class and JAXB , instead of xsd


Below is a link of how you could validate Data in a JAX-RS service using JAXB validation based on a schema:

  • Validate JAXBElement in JPA/JAX-RS Web Service

If you don't have an XML schema from your model, then you could use JAXB to generate one:

  • http://wiki.eclipse.org/EclipseLink/Examples/MOXy/JAXB/GenerateSchema

If you wanted to do validation without an XML schema you could use something like Bean Validation (JSR-303). With this you would still need to implement a custom MessageBodyReader/MessageBodyWriter.

0

精彩评论

暂无评论...
验证码 换一张
取 消