[JAVA]jsp 파일 읽어 저장
jsp 파일 읽어 저장
String serverIp = popertyService.getString("SERVER_IP");
InetAddress Address = InetAddress.getLocalHost();
String IP = Address.getHostAddress();
if (serverIp.equals(IP)){
// contentsPath 파일 체크
if (!result.getString("contentsPath").equals("")){
String path = rootPath + "/WEB-INF/jsp/egovframework" + (siteId.equals("3") ? result.getString("contentsPath").replaceAll("#lang#", lang) : result.getString("contentsPath")) ;
File file = new File(path);
if (file.exists()){
Date date = new Date();
date.setTime(file.lastModified());
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
String lastFileDate = formatter.format(date);
if (!lastFileDate.equals(result.getString("lastpathmodify"))){
// 파일 수정한 것임으로 디비에 update
CommonContentsService commonContentsService =(CommonContentsService)ctx.getBean("commonContentsService");
MenuLoadService menuLoadService =(MenuLoadService)ctx.getBean("menuLoadService");
MenuManageVO menuManageVO = new MenuManageVO();
menuManageVO.setMenuNo(result.getInt("menuNo"));
menuManageVO.setUserId("system");
menuManageVO.setModifyDay(date);
if (siteId.equals("3")) {
menuManageVO.setChLang(lang);
}
menuManageVO.setCvCon(FileUtils.readFileToString(file, "UTF-8"));
commonContentsService.modify(menuManageVO);
menuLoadService.menuLoad(pageContext.getServletContext(), Integer.parseInt(siteId));
}
}
}
}