Skip to content

Commit

Permalink
Adjust embedded server info property (#5226)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-adam authored Feb 14, 2024
1 parent a0f17de commit 0f37197
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/src/org/labkey/api/admin/AdminBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public static class RecentUser
public static final String serverGuid = AppProps.getInstance().getServerGUID();
public static final String serverSessionGuid = AppProps.getInstance().getServerSessionGUID();
public static final String servletContainer = ModuleLoader.getServletContext().getServerInfo();
public static final String servletConfiguration = AppProps.getInstance().isEmbeddedTomcat() ? "Embedded" : "Standalone";
public static final String sessionTimeout = Formats.commaf0.format(ModuleLoader.getServletContext().getSessionTimeout());
@SuppressWarnings("unused") // Available substitution property, not used directly in code
public static final String buildTime = ModuleLoader.getInstance().getCoreModule().getBuildTime();
Expand All @@ -96,11 +97,15 @@ public static class RecentUser
{
Map<String, String> propertyMap = new TreeMap<>();

// Using reflection, all static members of this class (see above) with type String are added to PROPERTY_MAP
// and available for substitutions
Arrays.stream(AdminBean.class.getDeclaredFields())
.filter(f -> Modifier.isStatic(f.getModifiers()))
.filter(f -> f.getType().equals(String.class))
.forEach(f -> propertyMap.put(f.getName(), getValue(f)));

// Using reflection, all primary DbScope public getters that return type String are added to PROPERTY_MAP and
// available for substitutions
Arrays.stream(scope.getClass().getMethods())
.filter(m -> m.getReturnType().equals(String.class))
.filter(m -> m.getName().startsWith("get"))
Expand Down
1 change: 1 addition & 0 deletions api/src/org/labkey/api/util/Formats.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class Formats
public static DecimalFormat percent1 = new DecimalFormat("0.0%");
public static DecimalFormat percent2 = new DecimalFormat("0.00%");
public static DecimalFormat commaf0 = new DecimalFormat("#,##0");
public static DecimalFormat commaf2 = new DecimalFormat("#,##0.##");
public static DecimalFormat commaf3 = new DecimalFormat("#,##0.###");
public static DecimalFormat chargeFilter = new DecimalFormat("0.#");

Expand Down
2 changes: 1 addition & 1 deletion core/src/org/labkey/core/admin/admin.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<tr class="<%=getShadeRowClass(row++)%>"><td>Mode</td><td><%=h(AdminBean.mode)%></td></tr>
<tr class="<%=getShadeRowClass(row++)%>"><td>Asserts</td><td><%=h(AdminBean.asserts)%></td></tr>
<tr class="<%=getShadeRowClass(row++)%>"><td>Servlet Container</td><td><%=h(AdminBean.servletContainer)%></td></tr>
<tr class="<%=getShadeRowClass(row++)%>"><td>Embedded Tomcat</td><td><%=h(AppProps.getInstance().isEmbeddedTomcat())%></td></tr>
<tr class="<%=getShadeRowClass(row++)%>"><td>Servlet Configuration</td><td><%=h(AdminBean.servletConfiguration)%></td></tr>
<tr class="<%=getShadeRowClass(row++)%>"><td>Session Timeout (minutes)</td><td><%=h(AdminBean.sessionTimeout)%></td></tr>
<tr class="<%=getShadeRowClass(row++)%>"><td>Java Runtime Vendor</td><td><%=h(AdminBean.javaVendor)%></td></tr>
<tr class="<%=getShadeRowClass(row++)%>"><td>Java Runtime Name</td><td><%=h(AdminBean.javaRuntimeName)%></td></tr>
Expand Down

0 comments on commit 0f37197

Please sign in to comment.