У меня проблема с egovframework из Кореи.Функция возобновления не работает при загрузке файлов.Для сравнения я перешел на домашнюю страницу Oracle и сравнил загрузку, но в Oracle включена функция возобновления паузы, но кнопка паузы в моем файле отключена.Я написал следующий код, в чем проблема?
</p>
<p>@RequestMapping(value = "/cmm/fms/FileDown.do")
public void cvplFileDownload(@RequestParam Map commandMap, HttpServletRequest request, HttpServletResponse response) throws Exception {</p>
<code> String atchFileId = (String) commandMap.get("atchFileId");
String fileSn = (String) commandMap.get("fileSn");
//egovframework login security
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
if (isAuthenticated) {
FileVO fileVO = new FileVO();
fileVO.setAtchFileId(atchFileId);
fileVO.setFileSn(fileSn);
FileVO fvo = fileService.selectFileInf(fileVO);
File uFile = new File(fvo.getFileStreCours(), fvo.getStreFileNm());
long fSize = uFile.length();
long start = 0;
if (fSize > 0) {
String mimetype = "application/x-msdownload";
response.setHeader("Accept-Ranges", "bytes");
if(request.getHeader("Range") != null){
response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
start = Long.parseLong(request.getHeader("Range").replaceAll("bytes=","").replaceAll("-", ""));
}
response.setHeader("Content-Length", new Long(fSize - start).toString());
if(start != 0 ){
response.setHeader("Content-Range", "bytes"
+ new Long(start).toString()+"-"
+ new Long(fSize - 1).toString()+"/"
+ new Long(fSize).toString());
}
response.setContentType(mimetype);
setDisposition(fvo.getOrignlFileNm(), request, response);
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(uFile));
in.skip(start);
byte[] b = new byte[1024];
int i;
while((i = in.read(b)) != -1){
response.getOutputStream().write(b,0,i);
response.flushBuffer();
}
in.close();
//FileCopyUtils.copy(in, out);
//out.flush();
} catch (Exception ex) {
LOGGER.debug("IGNORED: {}", ex.getMessage());
} finally {
if (in != null) {
try {
in.close();
} catch (Exception ignore) {
LOGGER.debug("IGNORED: {}", ignore.getMessage());
}
}
if (out != null) {
try {
out.close();
} catch (Exception ignore) {
LOGGER.debug("IGNORED: {}", ignore.getMessage());
}
}
}
} else {
response.setContentType("application/octet-stream");
setDisposition(fvo.getOrignlFileNm()+"_오류", request, response);
PrintWriter printwriter = response.getWriter();
printwriter.println(fvo.getOrignlFileNm()+" 파일이 존재하지 않습니다.");
printwriter.flush();
printwriter.close();
}
}
}<code>
</code>