try {
// call the appropriate handler.
response = fireEvent(request, page, instance);
}
catch (ValidationException ve) {
ConstraintViolationException cve = (ConstraintViolationException) ve.getCause();
Set<? extends ConstraintViolation<?>> scv = (Set<? extends ConstraintViolation<?>>) cve.getConstraintViolations();
List<String> errors = validationConvertor.to(scv);
response = Reply.with(errors).as(Json.class).badRequest();
}
return response;
}