users@jersey.java.net

Schema validation with jersey-spring

From: Mike Key <mike.key_at_gmail.com>
Date: Thu, 1 Apr 2010 17:42:24 -0600

I am in the first stages of my first Jersey interface using Spring and Jersey together along with a new need to have data elements validated on input (currently using simple JAXB annotations on the interface objects).

 I have now generated a schema from these objects and am tuning them for validation needs (eg. elements that are required or not required). However it appears that my sample requests are not doing schema validation when I send in objects with invalid elements (based on my schema).

I've seen a few posts from back around 2008 that creating my own JAXB context that does validation is the way to solve this. Is that still the case with Jersey today? Please feel free to point me to documentation I've missed if so :)

Also I've noticed a few posts to this mail alias about different validation means (JSON or XML) that people are considering as part of JSR 303. So my more important question is...I am 100% new to JSR303 and am wondering if using this type of validation is becoming preferred to XML schema validation or is to be used in conjunction with schema validation? And lastly if it is preferred to XML schema validation...do I use these annotations instead of JAXB annotations on an interface supporting JSON/XML with Jersey?

Sorry for all the questions, this seems compelling and I'm 100% new to this type of validation so just wondering how it fits in with schema validation.

Thanks in advance.