You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2024/12/02 15:56:42 UTC
(tomcat) branch 9.0.x updated (5adf342f83 -> 8769fefd09)
This is an automated email from the ASF dual-hosted git repository.
markt pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
from 5adf342f83 Code clean-up - formatting. No functional change
new c9c80c782a Fix return and code links when request URI has a pathInfo
new 8769fefd09 Remove out of date comments
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
webapps/docs/changelog.xml | 4 ++++
.../examples/WEB-INF/classes/CookieExample.java | 8 -------
.../WEB-INF/classes/RequestHeaderExample.java | 7 ------
.../WEB-INF/classes/RequestInfoExample.java | 25 +++++++++++-----------
.../WEB-INF/classes/RequestParamExample.java | 9 --------
.../examples/WEB-INF/classes/SessionExample.java | 8 -------
6 files changed, 16 insertions(+), 45 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 02/02: Remove out of date comments
Posted by ma...@apache.org.
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
commit 8769fefd0937aba06203c1cd4b1d257bf6b5db93
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Dec 2 15:36:59 2024 +0000
Remove out of date comments
---
webapps/examples/WEB-INF/classes/CookieExample.java | 8 --------
webapps/examples/WEB-INF/classes/RequestHeaderExample.java | 7 -------
webapps/examples/WEB-INF/classes/RequestParamExample.java | 9 ---------
webapps/examples/WEB-INF/classes/SessionExample.java | 8 --------
4 files changed, 32 deletions(-)
diff --git a/webapps/examples/WEB-INF/classes/CookieExample.java b/webapps/examples/WEB-INF/classes/CookieExample.java
index 32eb1f806c..0273511281 100644
--- a/webapps/examples/WEB-INF/classes/CookieExample.java
+++ b/webapps/examples/WEB-INF/classes/CookieExample.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ResourceBundle;
@@ -34,7 +33,6 @@ import util.HTMLFilter;
*
* @author James Duncan Davidson <duncan@eng.sun.com>
*/
-
public class CookieExample extends HttpServlet {
private static final long serialVersionUID = 1L;
@@ -65,12 +63,6 @@ public class CookieExample extends HttpServlet {
out.println("</head>");
out.println("<body bgcolor=\"white\">");
- // relative links
-
- // XXX
- // making these absolute till we work out the
- // addition of a PathInfo issue
-
out.println("<a href=\"../cookies.html\">");
out.println(
"<img src=\"../images/code.gif\" height=24 " + "width=24 align=right border=0 alt=\"view code\"></a>");
diff --git a/webapps/examples/WEB-INF/classes/RequestHeaderExample.java b/webapps/examples/WEB-INF/classes/RequestHeaderExample.java
index 98c0e6a987..b01c84f33e 100644
--- a/webapps/examples/WEB-INF/classes/RequestHeaderExample.java
+++ b/webapps/examples/WEB-INF/classes/RequestHeaderExample.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
@@ -96,12 +95,6 @@ public class RequestHeaderExample extends HttpServlet {
out.println("</head>");
out.println("<body bgcolor=\"white\">");
- // all links relative
-
- // XXX
- // making these absolute till we work out the
- // addition of a PathInfo issue
-
out.println("<a href=\"../reqheaders.html\">");
out.println(
"<img src=\"../images/code.gif\" height=24 " + "width=24 align=right border=0 alt=\"view code\"></a>");
diff --git a/webapps/examples/WEB-INF/classes/RequestParamExample.java b/webapps/examples/WEB-INF/classes/RequestParamExample.java
index 69482936c3..ac27ed45c9 100644
--- a/webapps/examples/WEB-INF/classes/RequestParamExample.java
+++ b/webapps/examples/WEB-INF/classes/RequestParamExample.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ResourceBundle;
@@ -53,14 +52,6 @@ public class RequestParamExample extends HttpServlet {
out.println("</head>");
out.println("<body bgcolor=\"white\">");
- // img stuff not req'd for source code HTML showing
-
- // all links relative
-
- // XXX
- // making these absolute till we work out the
- // addition of a PathInfo issue
-
out.println("<a href=\"../reqparams.html\">");
out.println(
"<img src=\"../images/code.gif\" height=24 " + "width=24 align=right border=0 alt=\"view code\"></a>");
diff --git a/webapps/examples/WEB-INF/classes/SessionExample.java b/webapps/examples/WEB-INF/classes/SessionExample.java
index 724b9b437d..407e2b3c0b 100644
--- a/webapps/examples/WEB-INF/classes/SessionExample.java
+++ b/webapps/examples/WEB-INF/classes/SessionExample.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
@@ -57,13 +56,6 @@ public class SessionExample extends HttpServlet {
out.println("</head>");
out.println("<body bgcolor=\"white\">");
- // img stuff not req'd for source code HTML showing
- // relative links everywhere!
-
- // XXX
- // making these absolute till we work out the
- // addition of a PathInfo issue
-
out.println("<a href=\"../sessions.html\">");
out.println(
"<img src=\"../images/code.gif\" height=24 " + "width=24 align=right border=0 alt=\"view code\"></a>");
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 01/02: Fix return and code links when request URI has a pathInfo
Posted by ma...@apache.org.
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
commit c9c80c782a30c15e3c6aac621972f9f127b71c01
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Dec 2 15:30:46 2024 +0000
Fix return and code links when request URI has a pathInfo
---
webapps/docs/changelog.xml | 4 ++++
.../WEB-INF/classes/RequestInfoExample.java | 25 +++++++++++-----------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index ea56af62b3..4a15dcd05d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -242,6 +242,10 @@
<code>allowedInternalProxies</code>. Pull request <pr>786</pr> provided
by Jorge Díaz. (markt)
</fix>
+ <fix>
+ Examples. Fix broken links when Servlet Request Info example is called
+ via a URL that includes a pathInfo component. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name = "Other">
diff --git a/webapps/examples/WEB-INF/classes/RequestInfoExample.java b/webapps/examples/WEB-INF/classes/RequestInfoExample.java
index 57665bb2c5..1538f5bc89 100644
--- a/webapps/examples/WEB-INF/classes/RequestInfoExample.java
+++ b/webapps/examples/WEB-INF/classes/RequestInfoExample.java
@@ -53,19 +53,18 @@ public class RequestInfoExample extends HttpServlet {
out.println("</head>");
out.println("<body bgcolor=\"white\">");
- // img stuff not req'd for source code HTML showing
- // all links relative!
-
- // XXX
- // making these absolute till we work out the
- // addition of a PathInfo issue
-
- out.println("<a href=\"../reqinfo.html\">");
- out.println(
- "<img src=\"../images/code.gif\" height=24 " + "width=24 align=right border=0 alt=\"view code\"></a>");
- out.println("<a href=\"../index.html\">");
- out.println(
- "<img src=\"../images/return.gif\" height=24 " + "width=24 align=right border=0 alt=\"return\"></a>");
+ /*
+ * Can't use relative paths since this servlet might have pathInfo. Allows for deployment to a different context
+ * path but otherwise assumes that the web application structure is not changed.
+ */
+ String baseURI = request.getServletContext().getContextPath() + "/servlets";
+
+ out.println("<a href=\"" + baseURI + "/reqinfo.html\">");
+ out.println("<img src=\"" + baseURI + "/images/code.gif\" height=24 " +
+ "width=24 align=right border=0 alt=\"view code\"></a>");
+ out.println("<a href=\"" + baseURI + "/index.html\">");
+ out.println("<img src=\"" + baseURI + "/images/return.gif\" height=24 " +
+ "width=24 align=right border=0 alt=\"return\"></a>");
out.println("<h3>" + title + "</h3>");
out.println("<table border=0><tr><td>");
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org