Input validation

Input validation is the process of ensuring the completeness and sanity of input data before posting it to the underlying data source. It is considered as an outer, defensive perimeter for your RESTful web APIs. JAX-RS 2.0 lets you use bean validation to declaratively specify the validation constraints on an object model. If you need a quick brush up on bean validation support for the JAX-RS resource class, refer to the Introducing validations in JAX-RS applications section in Chapter 4, Advanced Features in the JAX-RS API.

You can log input validation failures for business critical APIs. This may help you detect malformed and malicious input to the application.

Get RESTful Java Web Services - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.