Files
eapim-online/WebContent/healthCheck.jsp
cho 1c5d67d486 롤링배포를 위한 healthCheck 추가,
기존 eai/fep healthCheck와 동일.
2026-03-05 14:01:36 +09:00

84 lines
1.7 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=EUC-KR"%>
<%@ page import="java.io.*, java.util.*"%>
<%!private boolean fileCheck(String path, String fileName) throws Exception {
String name = System.getProperty("inst.Name");
File file = new File(path + File.separator + name + File.separator + fileName);
if (file.exists()) {
return false;
} else {
return true;
}
}
private String replaceServiceType(String data) {
String name = System.getProperty("inst.Name");
String serverType = name.substring(0, 3);
return data.replaceAll("\\$\\{serverType\\}", serverType);
}
private Properties getLoad(String path) {
Properties prop = new Properties();
InputStream input = null;
try {
input = new FileInputStream(path);
prop.load(input);
return prop;
} catch (Exception e) {
e.printStackTrace();
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return prop;
}%>
<%
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Expires", "0");
ClassLoader clsLoader = Thread.currentThread().getContextClassLoader();
InputStream input = clsLoader.getResourceAsStream("env.common.properties");
Properties props = new Properties();
props.load(input);
String path = props.getProperty("CHECK_PATH");
String fileName = props.getProperty("CHECK_FILE");
String path2 = replaceServiceType(path);
%>
<html>
<body>
<pre>
prop:CHECK_PATH=<%=path%><br>
prop:CHECK_FILE=<%=fileName%><br>
replace servicType=<%=path2%><br>
<%
if( !fileCheck(path2,fileName) ){
%>
status=500
<%
response.setStatus(500);
} else {
%>
status=200
<%
response.setStatus(200);
}
%>
</pre>
</body>
</html>