本文整理汇总了Java中javax.validation.executable.ExecutableType.NONE属性的典型用法代码示例。如果您正苦于以下问题:Java ExecutableType.NONE属性的具体用法?Java ExecutableType.NONE怎么用?Java ExecutableType.NONE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.validation.executable.ExecutableType
的用法示例。
在下文中一共展示了ExecutableType.NONE属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formPost
@POST
@ValidateOnExecution(type = ExecutableType.NONE)
public Response formPost(@Valid @BeanParam FormDataBean form) {
final BindingResult vr = getVr();
if (vr.isFailed()) {
ValidationError validationError = vr.getAllValidationErrors().iterator().next();
final ConstraintViolation<?> cv = validationError.getViolation();
final String property = cv.getPropertyPath().toString();
error.setProperty(property.substring(property.lastIndexOf('.') + 1));
error.setValue(cv.getInvalidValue());
error.setMessage(cv.getMessage());
error.setParam(validationError.getParamName());
return Response.status(BAD_REQUEST).entity("error.jsp").build();
}
return Response.status(OK).entity("data.jsp").build();
}
示例2: formPost
@POST
@Controller
@ValidateOnExecution(type = ExecutableType.NONE)
public Response formPost(@Valid @BeanParam FormDataBean form) {
if (br.isFailed()) {
ValidationError validationError = br.getAllValidationErrors().iterator().next();
final ConstraintViolation<?> cv = validationError.getViolation();
final String property = cv.getPropertyPath().toString();
error.setProperty(property.substring(property.lastIndexOf('.') + 1));
error.setValue(cv.getInvalidValue());
error.setMessage(cv.getMessage());
error.setParam(validationError.getParamName());
return Response.status(BAD_REQUEST).entity("error.jsp").build();
}
return Response.status(OK).entity("data.jsp").build();
}
示例3: addPerson
@POST
@Path("/person")
@ValidateOnExecution(type = ExecutableType.NONE)
@CsrfValid
public String addPerson(@BeanParam @Valid Person person) {
if (bindingResult.isFailed()) {
models.put("messages", bindingResult.getAllMessages());
} else {
dataStore.addPerson(person);
}
List<Person> personList = dataStore.getPersonList();
models.put("personList", personList);
return "person.jsp";
}
示例4: formPost
@POST
@ValidateOnExecution(type = ExecutableType.NONE)
public Response formPost(@Valid @BeanParam HelloBean form) {
if (validationResult.isFailed()) {
validationResult.getAllViolations().stream()
.forEach(v -> {
final String p = v.getPropertyPath().toString();
models.put(p.substring(p.lastIndexOf('.') + 1), v.getMessage());
});
models.put("form", form);
return Response.status(BAD_REQUEST).entity("form.jsp").build();
}
models.put("name", form.getFirstName() + " " + form.getLastName());
return Response.status(OK).entity("hello.jsp").build();
}
示例5: createProduct
@POST
@Path("new")
@Controller
@ValidateOnExecution(type = ExecutableType.NONE)
@CsrfValid
public String createProduct(@Valid
@BeanParam Product entity) {
if (validationResult.isFailed()) {
return ValidationUtil.getResponse(validationResult, error);
}
facade.create(entity);
return "redirect:product/list";
}
示例6: updateProduct
@POST
@Path("update")
@Controller
@ValidateOnExecution(type = ExecutableType.NONE)
@CsrfValid
public String updateProduct(@Valid
@BeanParam Product entity) {
if (validationResult.isFailed()) {
return ValidationUtil.getResponse(validationResult, error);
}
facade.edit(entity);
return "redirect:product/list";
}
示例7: createProductOrder
@POST
@Path("new")
@Controller
@ValidateOnExecution(type = ExecutableType.NONE)
@CsrfValid
public String createProductOrder(@Valid
@BeanParam ProductOrder entity) {
if (validationResult.isFailed()) {
return ValidationUtil.getResponse(validationResult, error);
}
facade.create(entity);
return "redirect:productOrder/list";
}
示例8: updateProductOrder
@POST
@Path("update")
@Controller
@ValidateOnExecution(type = ExecutableType.NONE)
@CsrfValid
public String updateProductOrder(@Valid
@BeanParam ProductOrder entity) {
if (validationResult.isFailed()) {
return ValidationUtil.getResponse(validationResult, error);
}
facade.edit(entity);
return "redirect:productOrder/list";
}
示例9: createCustomer
@POST
@Path("new")
@Controller
@ValidateOnExecution(type = ExecutableType.NONE)
@CsrfValid
public String createCustomer(@Valid
@BeanParam Customer entity) {
if (validationResult.isFailed()) {
return ValidationUtil.getResponse(validationResult, error);
}
facade.create(entity);
return "redirect:customer/list";
}
示例10: updateCustomer
@POST
@Path("update")
@Controller
@ValidateOnExecution(type = ExecutableType.NONE)
@CsrfValid
public String updateCustomer(@Valid
@BeanParam Customer entity) {
if (validationResult.isFailed()) {
return ValidationUtil.getResponse(validationResult, error);
}
facade.edit(entity);
return "redirect:customer/list";
}
示例11: save
@POST
@CsrfValid
@ValidateOnExecution(type = ExecutableType.NONE)
public Response save(@Valid @BeanParam TaskForm form) {
log.log(Level.INFO, "saving new task @{0}", form);
if (validationResult.isFailed()) {
AlertMessage alert = AlertMessage.danger("Validation voilations!");
validationResult.getAllViolations()
.stream()
.forEach((ConstraintViolation t) -> {
String path = t.getPropertyPath().toString();
alert.addError(path.substring(path.lastIndexOf(".") + 1), "", t.getMessage());
});
models.put("errors", alert);
return Response.status(BAD_REQUEST).entity("add.jspx").build();
}
Task task = new Task();
task.setName(form.getName());
task.setDescription(form.getDescription());
task.setDueDate(form.getDueDate());
taskRepository.save(task);
flashMessage.notify(Type.success, "Task was created successfully!");
//models.put("flashMessage", flashMessage);
return Response.ok("redirect:tasks").build();
}
示例12: save
@POST
//@CsrfValid
@ValidateOnExecution(type = ExecutableType.NONE)
public Response save(@Valid @BeanParam TaskForm form) {
log.log(Level.INFO, "saving new task @{0}", form);
if (validationResult.isFailed()) {
AlertMessage alert = AlertMessage.danger("Validation voilations!");
validationResult.getAllViolations()
.stream()
.forEach((ConstraintViolation t) -> {
String path = t.getPropertyPath().toString();
alert.addError(path.substring(path.lastIndexOf(".") + 1), "", t.getMessage());
});
models.put("errors", alert);
return Response.status(BAD_REQUEST).entity("add.xhtml").build();
}
Task task = new Task();
task.setName(form.getName());
task.setDescription(form.getDescription());
taskRepository.save(task);
flashMessage.notify(Type.success, "Task was created successfully!");
//models.put("flashMessage", flashMessage);
return Response.ok("redirect:tasks").build();
}
示例13: post
@POST
@ValidateOnExecution(type = ExecutableType.NONE)
public String post(@Valid @BeanParam FormBean form) {
if (bindingResult.isFailed()) {
List<String> errors = bindingResult.getAllValidationErrors().stream()
.map(ValidationError::getMessage)
.collect(Collectors.toList());
models.put("errors", errors);
}
return "form.jsp";
}