예제 #1
0
 @DoValidation(
     v = {ValidateDownload.class},
     to = "/hello/hello.html")
 @RequestMapping(value = "/download")
 public DoxModelAndView downloadFile(HelloForm form) throws Exception {
   Downloads.downloadFile(Paths.get("//LS-XHLE38/share/var/", form.getFileName()));
   return download(form);
 }
예제 #2
0
  @RequestMapping(value = "/upload", method = RequestMethod.POST)
  public DoxModelAndView upload(HelloForm form) {

    try (OutputStream stream =
        new BufferedOutputStream(
            new FileOutputStream(
                Paths.get("//LS-XHLE38/share/var/", form.getFileName()).toFile()))) {

      stream.write(form.getFile().getBytes());
      addMessage(new AppMessage(INFO, "completes.upload"));

    } catch (Exception e) {
      LOG.info("message = {}, stacktrace = {}", e.getMessage(), e.getStackTrace());
    }

    return view("/hello/hello.html", form);
  }