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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 2a5c21868c Use the canonical servlet context path
2a5c21868c is described below

commit 2a5c21868cbef0efc78e32eaf5f6a6379602ea3d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jul 4 15:10:35 2023 +0100

    Use the canonical servlet context path
    
    It is generally more efficient to use the canonical path from the
    context rather than the path from the request as that requires
    additional processing as it must return the non-decoded, non-normalized
    form.
    This also silences a false positive from Coverity Scan.
---
 webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java 
b/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
index edfee522bd..3b728284c7 100644
--- a/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
+++ b/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
@@ -44,7 +44,7 @@ public class SimpleImagePush extends HttpServlet {
             pw.println("<html>");
             pw.println("<body>");
             pw.println("<p>The following image was provided via a push 
request.</p>");
-            pw.println("<img src=\"" + req.getContextPath() + 
"/servlets/images/code.gif\"/>");
+            pw.println("<img src=\"" + getServletContext().getContextPath() + 
"/servlets/images/code.gif\"/>");
             pw.println("</body>");
             pw.println("</html>");
             pw.flush();


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to