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

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


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

commit 0fed3496a68798272fb98230422895c414c1d1b9
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 4f52def0cd..3da6895904 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