Skip to content

Commit

Permalink
Use the canonical servlet context path
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
markt-asf committed Jul 4, 2023
1 parent 83388f8 commit bd5b390
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
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();
Expand Down

0 comments on commit bd5b390

Please sign in to comment.