newController.createAction("fail_with_multiple_messages")
.createParam("count", "Number of error messages to generate")
.setHandler(new RequestHandler() {
@Override
public void handle(Request request, Response response) {
Errors errors = new Errors();
for (int count = 0; count < Integer.valueOf(request.param("count")); count++) {
errors.add(Message.of("Bad request reason #" + count));
}
throw new BadRequestException(errors);
}
});
newController.createAction("fail_with_multiple_i18n_messages")
.createParam("count", "Number of error messages to generate")
.setHandler(new RequestHandler() {
@Override
public void handle(Request request, Response response) {
Errors errors = new Errors();
for (int count = 0; count < Integer.valueOf(request.param("count")); count++) {
errors.add(Message.of("bad.request.reason", count));
}
throw new BadRequestException(errors);
}
});
newController.createAction("alive")