Index: core-module/pom.xml =================================================================== diff -u -re6039015a598bff5a05bf4dfb9a3734f57993f60 -rb8c3fa309abedec7d8920b148367d2dfe290b60e --- core-module/pom.xml (.../pom.xml) (revision e6039015a598bff5a05bf4dfb9a3734f57993f60) +++ core-module/pom.xml (.../pom.xml) (revision b8c3fa309abedec7d8920b148367d2dfe290b60e) @@ -7,7 +7,7 @@ 313devgrp java-service-tree-framework-core-library - 22.11.07 + 22.11.08 ../pom.xml @@ -31,7 +31,7 @@ 313devgrp lib-module - 22.11.07 + 22.11.08 pom Index: core-module/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedFileUtil.java =================================================================== diff -u -r3378aeef18251570015a9efbed6402f39cffd95d -rb8c3fa309abedec7d8920b148367d2dfe290b60e --- core-module/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedFileUtil.java (.../EgovFormBasedFileUtil.java) (revision 3378aeef18251570015a9efbed6402f39cffd95d) +++ core-module/src/main/java/egovframework/com/utl/fcc/service/EgovFormBasedFileUtil.java (.../EgovFormBasedFileUtil.java) (revision b8c3fa309abedec7d8920b148367d2dfe290b60e) @@ -179,6 +179,45 @@ } } + public static void downloadFile(HttpServletResponse response, String where, String serverSubPath, String physicalName, String contentType ,String original) throws Exception { + String downFileName = where + SEPERATOR + serverSubPath + SEPERATOR + physicalName; + + File file = new File(EgovWebUtil.filePathBlackList(downFileName)); + + if (!file.exists()) { + throw new FileNotFoundException(downFileName); + } + + if (!file.isFile()) { + throw new FileNotFoundException(downFileName); + } + + byte[] b = new byte[BUFFER_SIZE]; + + original = original.replaceAll("\r", "").replaceAll("\n", ""); + response.setContentType(contentType); + response.setHeader("Content-Disposition", "attachment; filename=\"" + convert(original) + "\";"); + response.setHeader("Content-Transfer-Encoding", "binary"); + response.setHeader("Pragma", "no-cache"); + response.setHeader("Expires", "0"); + + BufferedInputStream fin = null; + BufferedOutputStream outs = null; + + try { + fin = new BufferedInputStream(new FileInputStream(file)); + outs = new BufferedOutputStream(response.getOutputStream()); + + int read = 0; + + while ((read = fin.read(b)) != -1) { + outs.write(b, 0, read); + } + } finally { + EgovResourceCloseHelper.close(outs, fin); + } + } + public static void viewFile(HttpServletResponse response, String where, String serverSubPath, String physicalName, String mimeTypeParam) throws Exception { String mimeType = mimeTypeParam; String downFileName = where + SEPERATOR + serverSubPath + SEPERATOR + physicalName; Index: lib-module/pom.xml =================================================================== diff -u -re6039015a598bff5a05bf4dfb9a3734f57993f60 -rb8c3fa309abedec7d8920b148367d2dfe290b60e --- lib-module/pom.xml (.../pom.xml) (revision e6039015a598bff5a05bf4dfb9a3734f57993f60) +++ lib-module/pom.xml (.../pom.xml) (revision b8c3fa309abedec7d8920b148367d2dfe290b60e) @@ -5,7 +5,7 @@ 313devgrp java-service-tree-framework-core-library - 22.11.07 + 22.11.08 ../pom.xml Index: pom.xml =================================================================== diff -u -re6039015a598bff5a05bf4dfb9a3734f57993f60 -rb8c3fa309abedec7d8920b148367d2dfe290b60e --- pom.xml (.../pom.xml) (revision e6039015a598bff5a05bf4dfb9a3734f57993f60) +++ pom.xml (.../pom.xml) (revision b8c3fa309abedec7d8920b148367d2dfe290b60e) @@ -10,7 +10,7 @@ 4.0.0 313devgrp java-service-tree-framework-core-library - 22.11.07 + 22.11.08 pom java-service-tree-framework-core-library