This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 36009ec585de82574b463daf20dfe46966bb7288
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              | 8 ++++++++
 java/org/apache/catalina/core/StandardContext.java | 3 +++
 webapps/docs/changelog.xml                         | 5 +++++
 3 files changed, 16 insertions(+)

diff --git a/java/org/apache/catalina/Globals.java 
b/java/org/apache/catalina/Globals.java
index b25ee32..f8a2c80 100644
--- a/java/org/apache/catalina/Globals.java
+++ b/java/org/apache/catalina/Globals.java
@@ -292,4 +292,12 @@ public final class Globals {
      */
     public static final String CREDENTIAL_HANDLER
             = "org.apache.catalina.CredentialHandler";
+
+
+    /**
+     * 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";
 }
diff --git a/java/org/apache/catalina/core/StandardContext.java 
b/java/org/apache/catalina/core/StandardContext.java
index dba5d2b..2abdac1 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -5136,6 +5136,9 @@ public class StandardContext extends ContainerBase
                 // Create context attributes that will be required
                 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 a4218aa..6f4702f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -91,6 +91,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]

Reply via email to