NIHVIVO-336 Show the name of the app (context path) in the raw startup-status display.

This commit is contained in:
j2blake 2011-09-27 14:52:38 +00:00
parent c6f8a50de6
commit 2bb5b25c7a
2 changed files with 13 additions and 3 deletions

View file

@ -68,8 +68,9 @@ public class StartupStatusDisplayFilter implements Filter {
try {
Map<String, Object> bodyMap = new HashMap<String, Object>();
bodyMap.put("status", StartupStatus.getBean(ctx));
bodyMap.put("status", ss);
bodyMap.put("showLink", !isFatal());
bodyMap.put("contextPath", getContextPath());
hResp.setStatus(SC_INTERNAL_SERVER_ERROR);
Template tpl = loadFreemarkerTemplate();
@ -79,6 +80,15 @@ public class StartupStatusDisplayFilter implements Filter {
}
}
private String getContextPath() {
String cp = ctx.getContextPath();
if ((cp == null) || cp.isEmpty()) {
return "The application";
} else {
return cp;
}
}
private Template loadFreemarkerTemplate() throws IOException {
Configuration cfg = new Configuration();
cfg.setTemplateLoader(new WebappTemplateLoader(ctx));