6.4.2. JAX-RS BeanValidation Handler

This handler executes Bean Validation for Form (Bean) received by the resource (action) class. If a validation error occurs during validation, the process is not delegated to the subsequent handler, and the process is ended after sending ApplicationException.

This handler performs the following process.

  • Performs Bean Validation for the form received by the resource (action) class method.

The process flow is as follows.

../../../../_images/flow16.png Module list


<!-- Bean Validation module -->
</dependency> Constraints

Configure this handler after the Request Body Conversion Handler
Since this handler is for the validation of Form (Bean) converted from the request body by the Request Body Conversion Handler. Execute validation for Form (Bean) received by resource (action)

To validate the Form (Bean) received by the resource (action) method, configure Valid annotation for that method.

An example is shown below.

// Since validation has to be performed on the Person object,
// configure a Valid annotation.
public HttpResponse save(Person person) {
    return new HttpResponse();