--- src/main/java/itn/com/cmm/util/PdfUtil.java
+++ src/main/java/itn/com/cmm/util/PdfUtil.java
... | ... | @@ -143,7 +143,7 @@ |
| 143 | 143 |
e.printStackTrace(); |
| 144 | 144 |
} |
| 145 | 145 |
|
| 146 |
- return "/usr/local/tomcat/file/sht/pdf/" + uuid + ".pdf"; |
|
| 146 |
+ return uuid + ".pdf"; |
|
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
|
--- src/main/java/itn/com/cmm/web/EgovFileDownloadController.java
+++ src/main/java/itn/com/cmm/web/EgovFileDownloadController.java
... | ... | @@ -452,4 +452,75 @@ |
| 452 | 452 |
} |
| 453 | 453 |
} |
| 454 | 454 |
|
| 455 |
+ |
|
| 456 |
+ /** |
|
| 457 |
+ * 첨부파일로 등록된 파일에 대하여 다운로드를 제공한다. |
|
| 458 |
+ * |
|
| 459 |
+ * @param commandMap |
|
| 460 |
+ * @param response |
|
| 461 |
+ * @throws Exception |
|
| 462 |
+ */ |
|
| 463 |
+ @RequestMapping(value = "/cmm/fms/FileDowntest.do") |
|
| 464 |
+ public void FileDowntest(@RequestParam Map<String, Object> commandMap, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
| 465 |
+ |
|
| 466 |
+ String fileNm = (String) commandMap.get("fileNm");
|
|
| 467 |
+ try {
|
|
| 468 |
+ |
|
| 469 |
+ |
|
| 470 |
+ File uFile = new File("/usr/local/tomcat/file/sht/pdf/", fileNm);
|
|
| 471 |
+ long fSize = uFile.length(); |
|
| 472 |
+ |
|
| 473 |
+ if (fSize > 0) {
|
|
| 474 |
+ String mimetype = "application/x-msdownload"; |
|
| 475 |
+ |
|
| 476 |
+ response.setContentType(mimetype); |
|
| 477 |
+ setDisposition(fileNm, request, response); |
|
| 478 |
+ //response.setContentLength(fSize); |
|
| 479 |
+ |
|
| 480 |
+ BufferedInputStream in = null; |
|
| 481 |
+ BufferedOutputStream out = null; |
|
| 482 |
+ |
|
| 483 |
+ try {
|
|
| 484 |
+ in = new BufferedInputStream(new FileInputStream(uFile)); |
|
| 485 |
+ out = new BufferedOutputStream(response.getOutputStream()); |
|
| 486 |
+ |
|
| 487 |
+ FileCopyUtils.copy(in, out); |
|
| 488 |
+ out.flush(); |
|
| 489 |
+ } catch (Exception ex) {
|
|
| 490 |
+ LOGGER.debug("IGNORED: {}", ex.getMessage());
|
|
| 491 |
+ } finally {
|
|
| 492 |
+ if (in != null) {
|
|
| 493 |
+ try {
|
|
| 494 |
+ in.close(); |
|
| 495 |
+ } catch (Exception ignore) {
|
|
| 496 |
+ LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
|
| 497 |
+ } |
|
| 498 |
+ } |
|
| 499 |
+ if (out != null) {
|
|
| 500 |
+ try {
|
|
| 501 |
+ out.close(); |
|
| 502 |
+ } catch (Exception ignore) {
|
|
| 503 |
+ LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
|
| 504 |
+ } |
|
| 505 |
+ } |
|
| 506 |
+ } |
|
| 507 |
+ |
|
| 508 |
+ } else {
|
|
| 509 |
+ response.setContentType("application/x-msdownload");
|
|
| 510 |
+ |
|
| 511 |
+ PrintWriter printwriter = response.getWriter(); |
|
| 512 |
+ printwriter.println("<html>");
|
|
| 513 |
+ printwriter.println("<br><br><br><h2>Could not get file name:<br>" + fileNm + "</h2>");
|
|
| 514 |
+ printwriter.println("<br><br><br><center><h3><a href='javascript: history.go(-1)'>Back</a></h3></center>");
|
|
| 515 |
+ printwriter.println("<br><br><br>© webAccess");
|
|
| 516 |
+ printwriter.println("</html>");
|
|
| 517 |
+ printwriter.flush(); |
|
| 518 |
+ printwriter.close(); |
|
| 519 |
+ } |
|
| 520 |
+ |
|
| 521 |
+ } catch (Exception e) {
|
|
| 522 |
+ System.out.println(e.getMessage()); |
|
| 523 |
+ } |
|
| 524 |
+ } |
|
| 525 |
+ |
|
| 455 | 526 |
} |
--- src/main/webapp/WEB-INF/jsp/uss/ion/msg/pdfView.jsp
+++ src/main/webapp/WEB-INF/jsp/uss/ion/msg/pdfView.jsp
... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 |
var ctx = canvas.getContext('2d');
|
| 51 | 51 |
/* var url = '/cmm/fms/FileDown.do?atchFileId=FILE_000000000019061&fileSn=0'; */ |
| 52 | 52 |
// var url = '/usr/local/tomcat/file/sht/pdf/2ccbb16e-62df-48c0-bbb1-3b6559bd4c36.pdf'; |
| 53 |
- var url = '<c:url value="${pdfPath}"/>';
|
|
| 53 |
+ var url = '/cmm/fms/FileDowntest.do?fileNm=${pdfPath}';
|
|
| 54 | 54 |
|
| 55 | 55 |
/** |
| 56 | 56 |
* Get page info from document, resize canvas accordingly, and render page. |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?