InputStream cInputStream = null;
StringBuilder sb = new StringBuilder();
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
inputStream = loader.getResourceAsStream("application-files.properties");
Properties props = new LinkedProperties();
props.load(inputStream);
Set<Object> fileKeySet = props.keySet();
for (Object obj : fileKeySet) {
logger.debug("读取文件:key={}, value={}", obj, props.getProperty(obj.toString()));
sb.append("<span style='color:red;font-weight:bold;'>" + props.getProperty(obj.toString()) + "</span><br/>");
if (props.getProperty(obj.toString()).startsWith("file:")) {
File file = new File(props.getProperty(obj.toString()).split(":")[1]);
if (file.getParentFile() != null && !file.getParentFile().exists()) {
continue;
}
if (!file.exists()) {
continue;
}
cInputStream = new FileInputStream(file);
} else {
cInputStream = loader.getResourceAsStream(props.getProperty(obj.toString()));
}
Properties cProps = new LinkedProperties();
cProps.load(cInputStream);
Set<Object> cFileKeySet = cProps.keySet();
for (Object cObj : cFileKeySet) {
sb.append(cObj.toString() + "<span style='color:red;font-weight:bold;'>=</span>" + cProps.get(cObj.toString()) + "<br/>");
}
cInputStream.close();
}
inputStream.close();
resp.setContentType("text/html");