diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/admin/StartupStatusController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/admin/StartupStatusController.java index f9107feaf..a782954ea 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/admin/StartupStatusController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/admin/StartupStatusController.java @@ -7,6 +7,7 @@ import java.util.Map; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.SeeStartupStatus; +import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; @@ -29,8 +30,36 @@ public class StartupStatusController extends FreemarkerHttpServlet { body.put("title", "Startup Status"); body.put("status", StartupStatus.getBean(getServletContext())); + body.put("contextPath", getContextPath()); + body.put("applicationName", getApplicationName()); return new TemplateResponseValues("startupStatus-display.ftl", body); } + private String getContextPath() { + String cp = getServletContext().getContextPath(); + if ((cp == null) || cp.isEmpty()) { + return "The application"; + } else { + return cp; + } + } + + private Object getApplicationName() { + String name = ""; + try { + ApplicationBean app = ApplicationBean.getAppBean(getServletContext()); + name = app.getApplicationName(); + } catch (Exception e) { + // deal with problems below + } + + if ((name != null) && (!name.isEmpty())) { + return name; + } else { + return getContextPath(); + } + } + + } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/StartupStatusDisplayFilter.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/StartupStatusDisplayFilter.java index f0e19b4e8..f391bd9b7 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/StartupStatusDisplayFilter.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/filters/StartupStatusDisplayFilter.java @@ -17,6 +17,7 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; +import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean; import edu.cornell.mannlib.vitro.webapp.startup.StartupStatus; import freemarker.cache.WebappTemplateLoader; import freemarker.template.Configuration; @@ -29,7 +30,7 @@ import freemarker.template.TemplateException; * StartupStatus display page. * * If the status only contains warnings, this only happens once. Subsequent - * requests will display normally. However, if the status contains a fatal + * requests will display normally. However, if the status contains a fatal * error, this filter will hijack every request, and will not let you proceed. */ public class StartupStatusDisplayFilter implements Filter { @@ -72,6 +73,7 @@ public class StartupStatusDisplayFilter implements Filter { bodyMap.put("status", ss); bodyMap.put("showLink", !isFatal()); bodyMap.put("contextPath", getContextPath()); + bodyMap.put("applicationName", getApplicationName()); hResp.setStatus(SC_INTERNAL_SERVER_ERROR); Template tpl = loadFreemarkerTemplate(); @@ -90,6 +92,22 @@ public class StartupStatusDisplayFilter implements Filter { } } + private Object getApplicationName() { + String name = ""; + try { + ApplicationBean app = ApplicationBean.getAppBean(ctx); + name = app.getApplicationName(); + } catch (Exception e) { + // deal with problems below + } + + if ((name != null) && (!name.isEmpty())) { + return name; + } else { + return getContextPath(); + } + } + private Template loadFreemarkerTemplate() throws IOException { Configuration cfg = new Configuration(); cfg.setTemplateLoader(new WebappTemplateLoader(ctx)); diff --git a/webapp/web/templates/freemarker/body/admin/startupStatus-display.ftl b/webapp/web/templates/freemarker/body/admin/startupStatus-display.ftl index 8a424224a..f55cb53fc 100644 --- a/webapp/web/templates/freemarker/body/admin/startupStatus-display.ftl +++ b/webapp/web/templates/freemarker/body/admin/startupStatus-display.ftl @@ -25,7 +25,7 @@
@@ -37,7 +37,7 @@ ${stylesheets.add(' <#list status.errorItems as item> @@ -49,7 +49,7 @@ ${stylesheets.add('<#list status.warningItems as item> <@statusItem item=item /> diff --git a/webapp/web/templates/freemarker/body/admin/startupStatus-displayRaw.ftl b/webapp/web/templates/freemarker/body/admin/startupStatus-displayRaw.ftl index 73baf9240..e9bb2194e 100644 --- a/webapp/web/templates/freemarker/body/admin/startupStatus-displayRaw.ftl +++ b/webapp/web/templates/freemarker/body/admin/startupStatus-displayRaw.ftl @@ -29,7 +29,7 @@ @@ -79,7 +79,7 @@ <#if status.errorItems?has_content>VIVO detected a fatal error during startup.
+${applicationName} detected a fatal error during startup.