Ejemplo n.º 1
0
  @ExtDirectMethod(value = ExtDirectMethodType.FORM_POST_JSON)
  public ExtDirectFormPostResult handleFormSubmitNoMultipartFileNoExtra(
      @Valid FormBean bean, BindingResult result1) {
    String resultString = "Server received: \n" + bean.toString() + "\n";

    ExtDirectFormPostResult result = new ExtDirectFormPostResult();
    result.addResultProperty("response", resultString);
    return result;
  }
Ejemplo n.º 2
0
  @ExtDirectMethod(value = FORM_POST)
  public ExtDirectFormPostResult handleFormSubmit(@Valid FormBean bean) {
    String resultString = "Server received: \n" + bean.toString();
    resultString += "\n";

    ExtDirectFormPostResult result = new ExtDirectFormPostResult();
    result.addResultProperty("response", resultString);
    return result;
  }
Ejemplo n.º 3
0
  @ExtDirectMethod(value = ExtDirectMethodType.FORM_POST)
  @RequestMapping(value = "/handleFormMultipartSubmit", method = RequestMethod.GET)
  public ExtDirectFormPostResult handleFormMultipartSubmit(
      @RequestBody MultiValueMap<String, String> body,
      @Valid FormBean bean,
      MultipartFile screenshot) {
    logger.debug("body [{}]", body.toSingleValueMap());
    Assert.notEmpty(bean.any(), "@JsonAnySetter not filled");
    String resultString = "Server received: \n" + bean.toString() + "\n";

    if (!screenshot.isEmpty()) {
      resultString += "ContentType: " + screenshot.getContentType() + "\n";
      resultString += "Size: " + screenshot.getSize() + "\n";
      resultString += "Name: " + screenshot.getOriginalFilename();
    }

    ExtDirectFormPostResult result = new ExtDirectFormPostResult();
    result.addResultProperty("response", resultString);
    return result;
  }
Ejemplo n.º 4
0
  @ExtDirectMethod(value = ExtDirectMethodType.FORM_POST_JSON)
  public ExtDirectFormPostResult handleFormSubmitNoMultipartFile(
      @RequestParam(value = "p1", required = true) Long param1,
      @RequestParam(value = "p2", required = true) String param2,
      @Valid FormBean bean)
      throws Exception {
    DataBinder binder = new DataBinder(bean);
    binder.setValidator(this.validator);
    validator.validate(bean, binder.getBindingResult());

    logger.debug("any [{}]", bean.any());
    ExtDirectFormPostResult formPostResult = new ExtDirectFormPostResult(binder.getBindingResult());
    String resultString = "Server received: \n" + bean.toString() + "\n";
    if (bean.any().isEmpty()) {
      // throw new Exception("Error: @JsonAnySetter not filled");
      resultString = "Error: @JsonAnySetter not filled";
      formPostResult.setSuccess(false);
    }

    formPostResult.addResultProperty("response", resultString);
    return formPostResult;
  }