This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit c750ae6602be1a3cd24566116404bdcf2c13ff8e Author: Mark Thomas <[email protected]> AuthorDate: Mon Mar 2 19:39:15 2020 +0000 Expose the web application version String as a ServletContext attribute Fixes https://bz.apache.org/bugzilla/show_bug.cgi?id=64189 Attribute: org.apache.catalina.webappVersion --- java/org/apache/catalina/Globals.java | 9 +++++++++ java/org/apache/catalina/core/StandardContext.java | 3 +++ webapps/docs/changelog.xml | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/java/org/apache/catalina/Globals.java b/java/org/apache/catalina/Globals.java index d079697..46c30e1 100644 --- a/java/org/apache/catalina/Globals.java +++ b/java/org/apache/catalina/Globals.java @@ -369,6 +369,15 @@ public final class Globals { public static final String JASPER_XML_BLOCK_EXTERNAL_INIT_PARAM = "org.apache.jasper.XML_BLOCK_EXTERNAL"; + + /** + * Name of the ServletContext attribute under which we store the web + * application version string (the text that appears after ## when parallel + * deployment is used). + */ + public static final String WEBAPP_VERSION = "org.apache.catalina.webappVersion"; + + @Deprecated // Will be removed in Tomcat 9.0.x public static final boolean IS_ORACLE_JVM = JreVendor.IS_ORACLE_JVM; diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index fce298c..b40f36e 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -5631,6 +5631,9 @@ public class StandardContext extends ContainerBase if (ok) { getServletContext().setAttribute( JarScanner.class.getName(), getJarScanner()); + + // Make the version info available + getServletContext().setAttribute(Globals.WEBAPP_VERSION, getWebappVersion()); } // Set up the context init params diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 5ede4c2..1deb684 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -97,6 +97,11 @@ support authentication persistence. Patch provided by Carsten Klein. (markt) </add> + <add> + <bug>64189</bug>: Expose the web application version String as a + <code>ServletContext</code> attribute named + <code>org.apache.catalina.webappVersion</code>. (markt) + </add> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
