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

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


The following commit(s) were added to refs/heads/main by this push:
     new bd5b3907cb Use the canonical servlet context path
bd5b3907cb is described below

commit bd5b3907cb48a4f53037d5f5758dff9fc40daa31
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