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));

View file

@ -79,7 +79,7 @@
<body>
<#if status.errorItems?has_content>
<h2>Fatal error</h2>
<p>VIVO detected a fatal error during startup.</p>
<p>${contextPath} detected a fatal error during startup.</p>
<#if showLink>
<p><a href=".">Continue</a></p>
</#if>
@ -90,7 +90,7 @@
<#if status.warningItems?has_content>
<h2>Warning</h2>
<p>VIVO issued warnings during startup.</p>
<p>${contextPath} found problems during startup.</p>
<#if showLink>
<p><a href=".">Continue</a></p>
</#if>