From e4a678159ef24826685c12a10c03c52459b3b8f7 Mon Sep 17 00:00:00 2001 From: leebj Date: Tue, 20 Aug 2024 13:09:46 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EB=89=B4=EC=96=BC=20=EB=8B=A4?= =?UTF-8?q?=EC=9A=B4=EB=A1=9C=EB=93=9C=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/fims/base/web/FileController.java | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/java/cokr/xit/fims/base/web/FileController.java b/src/main/java/cokr/xit/fims/base/web/FileController.java index 990356cd..a4c5f64b 100644 --- a/src/main/java/cokr/xit/fims/base/web/FileController.java +++ b/src/main/java/cokr/xit/fims/base/web/FileController.java @@ -13,6 +13,7 @@ import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.function.Consumer; import java.util.regex.Matcher; import javax.annotation.Resource; @@ -54,6 +55,7 @@ import cokr.xit.fims.crdn.dao.CrdnInfoMapper; import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.sprt.Sprt; import cokr.xit.fims.sprt.service.bean.MediaBean; +import cokr.xit.foundation.Downloadable; import cokr.xit.foundation.data.DataObject; @Controller @@ -298,10 +300,26 @@ public class FileController extends cokr.xit.base.file.web.FileController { } InputStream menualIS = cps.getInputStream(); - mav.addObject("file", menualIS); - mav.addObject("filename", "과태료통합관리시스템_메뉴얼"+"("+"v"+menualVersion+")"+".pptx"); - mav.addObject("contentType", "application/vnd.openxmlformats-officedocument.presentationml.presentation"); - mav.addObject("length", menualIS.available()); + byte[] menualBytes = menualIS.readAllBytes(); + menualIS.close(); + + Consumer writer = new Consumer() { + @Override + public void accept(OutputStream os) { + try { + os.write(menualBytes); + } catch (IOException e) { + e.printStackTrace(); + } + } + }; + + mav.addObject("download", + new Downloadable() + .setContentType("application/vnd.openxmlformats-officedocument.presentationml.presentation") + .setWriter(writer) + .setFilename("과태료통합관리시스템_메뉴얼"+"("+"v"+menualVersion+")"+".pptx") + ); return mav; }