Rest service post bean validation -
i stuck problem of post body attributes validation. need throw exception or show error, when invalid attribute passed down json request body. have no idea how that? please help.
fyi : using jersey api.
why cant use jersey's bean validation support examples , docs- here?
bean validation support in jersey provided extension module , needs mentioned explicitly in pom.xml file (in case of using maven): <dependency> <groupid>org.glassfish.jersey.ext</groupid> <artifactid>jersey-bean-validation</artifactid> <version>2.22.1</version> </dependency>
you can define custom validations , validationerror messages.
in jsp add validation-errors tags , done.
<div class="validation-errors"> <div class="validation-error">
or can sent json format error response.
[ { "message" : "xxxxxx.", "messagetemplate" : "{xxx.does.not.exist}", "path" : "abc.xyz.<return value>" } ]
Comments
Post a Comment