Set<? extends ConstraintViolation<?>> scv = (Set<? extends ConstraintViolation<?>>) cve.getConstraintViolations();
errors = validationConvertor.to(scv);
}
//render to respond
Respond respond = new StringBuilderRespond(instance);
respond.setErrors(errors);
if (null != redirect) {
if (redirect instanceof String)
respond.redirect((String) redirect);
else if (redirect instanceof Class) {
PageBook.Page targetPage = book.forClass((Class<?>) redirect);
// should never be null coz it is validated on compile.
respond.redirect(contextualize(request, targetPage.getUri()));
} else if (redirect instanceof Reply<?>) {
// To allow non-headless pages to use Reply<?> for more advanced HTTP responses
return redirect;
} else {
// Handle page-chaining driven redirection.
PageBook.Page targetPage = book.forInstance(redirect);
// should never be null coz it will be validated at compile time.
flashCacheProvider.get().put(targetPage.getUri(), targetPage);
// Send to the canonical address of the page. This is also
// verified at compile, not be a variablized matcher.
respond.redirect(contextualize(request, targetPage.getUri()));
}
} else {
page.widget().render(instance, respond);
}