@Override public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HelloForm actionForm = (HelloForm) form; request.setAttribute("name", actionForm.getName()); return mapping.findForward("success"); }
@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); }
@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); }
@RequestMapping(value = "/output-report") public void outputReportPdf(HelloForm form) throws Exception { DoxBirt birt = new DoxBirt("/sample/hello/hello.rptdesign", "//LS-XHLE38/share/var/hello.pdf", PDF); birt.output("hello", "Hello, BIRT"); form.setFileName("hello.pdf"); downloadFile(form); }
// @Token(CHECK_AND_SET) @DoValidation( v = {Validate.class}, to = "/hello/hello.html") @RequestMapping("/input") public DoxModelAndView input(HelloForm form) { this.helloService.search(form); LOG.info("ログ出力テスト2, {}", form.getResults()); addMessage(new AppMessage(INFO, "hello2", prop("val"), prop("samplemes"))); return view("/hello/hello.html", form); }
@RequestMapping(value = "/output-xls") public void outputReportXls(HelloForm form) throws Exception { DoxBirt birt = new DoxBirt( "/sample/hello/hello_xls.rptdesign", "//LS-XHLE38/share/var/hello.xlsx", XLSX_OFFICE2010); birt.output("hello", "Hello, BIRT"); form.setFileName("hello.xlsx"); downloadFile(form); }