diff --git a/WebContent/WEB-INF/properties/env.common.properties b/WebContent/WEB-INF/properties/env.common.properties index 9122d87..c0ed140 100644 --- a/WebContent/WEB-INF/properties/env.common.properties +++ b/WebContent/WEB-INF/properties/env.common.properties @@ -24,4 +24,9 @@ use.internal.queue=false # sync-async mapping use.internal.topic=true # restore mapping -use.cache.store=true \ No newline at end of file +use.cache.store=true + + +#healthCheck.jsp +CHECK_PATH=/App/{serverType}/chkfile +CHECK_FILE=healthCheckFalse \ No newline at end of file diff --git a/WebContent/healthCheck.jsp b/WebContent/healthCheck.jsp new file mode 100644 index 0000000..dbb8dd0 --- /dev/null +++ b/WebContent/healthCheck.jsp @@ -0,0 +1,84 @@ +<%@ 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); +%> + + +
++ prop:CHECK_PATH=<%=path%>+ + \ No newline at end of file
+ prop:CHECK_FILE=<%=fileName%>
+ replace servicType=<%=path2%>
+ + + <% + if( !fileCheck(path2,fileName) ){ + %> + status=500 + <% + response.setStatus(500); + } else { + %> + status=200 + <% + response.setStatus(200); + } + %> +