Hi,

The links on the static pages in the servlets section of the examples 
webapp are all relative, allowing you to deploy the app anywhere, however 
the servlets themselves generate absolute links to /examples/. The 
attached patch fixes.

Cheers,
Gary

[ [EMAIL PROTECTED] ][ GnuPG 85A8F78B ][ http://inauspicious.org/ ]
Replace absolute links in the servlets with relative ones, so that the
images and links work properly regardless of where the app is deployed.

Index: webapps/examples/WEB-INF/classes/CookieExample.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/CookieExample.java,v

retrieving revision 1.2
diff -u -r1.2 CookieExample.java
--- webapps/examples/WEB-INF/classes/CookieExample.java 11 Jun 2001 22:49:11 -0000     
 1.2
+++ webapps/examples/WEB-INF/classes/CookieExample.java 31 Jan 2002 02:33:42 -0000
@@ -36,15 +36,11 @@
 
        // relative links
 
-        // XXX
-        // making these absolute till we work out the
-        // addition of a PathInfo issue 
-       
-        out.println("<a href=\"/examples/servlets/cookies.html\">");
-        out.println("<img src=\"/examples/images/code.gif\" height=24 " +
+        out.println("<a href=\"../servlets/cookies.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"view code\"></a>");
-        out.println("<a href=\"/examples/servlets/index.html\">");
-        out.println("<img src=\"/examples/images/return.gif\" height=24 " +
+        out.println("<a href=\"../servlets/index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"return\"></a>");
 
         out.println("<h3>" + title + "</h3>");
Index: webapps/examples/WEB-INF/classes/HelloWorldExample.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/HelloWorldExample.java,v

retrieving revision 1.2
diff -u -r1.2 HelloWorldExample.java
--- webapps/examples/WEB-INF/classes/HelloWorldExample.java     29 Nov 2001 18:27:25 
-0000      1.2
+++ webapps/examples/WEB-INF/classes/HelloWorldExample.java     31 Jan 2002 02:33:42 
+-0000
@@ -40,15 +40,11 @@
        // servlet belongs to to a different place in the url
        // tree and not have any harmful side effects.
 
-        // XXX
-        // making these absolute till we work out the
-        // addition of a PathInfo issue
-
-           out.println("<a href=\"/examples/servlets/helloworld.html\">");
-        out.println("<img src=\"/examples/images/code.gif\" height=24 " +
+           out.println("<a href=\"../servlets/helloworld.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"view code\"></a>");
-        out.println("<a href=\"/examples/servlets/index.html\">");
-        out.println("<img src=\"/examples/images/return.gif\" height=24 " +
+        out.println("<a href=\"../servlets/index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"return\"></a>");
         out.println("<h1>" + title + "</h1>");
         out.println("</body>");
Index: webapps/examples/WEB-INF/classes/RequestHeaderExample.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/RequestHeaderExample.java,v

retrieving revision 1.1
diff -u -r1.1 RequestHeaderExample.java
--- webapps/examples/WEB-INF/classes/RequestHeaderExample.java  17 Aug 2000 00:57:53 
-0000      1.1
+++ webapps/examples/WEB-INF/classes/RequestHeaderExample.java  31 Jan 2002 02:33:42 
+-0000
@@ -36,15 +36,11 @@
 
        // all links relative
 
-        // XXX
-        // making these absolute till we work out the
-        // addition of a PathInfo issue 
-       
-        out.println("<a href=\"/examples/servlets/reqheaders.html\">");
-        out.println("<img src=\"/examples/images/code.gif\" height=24 " +
+        out.println("<a href=\"../servlets/reqheaders.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"view code\"></a>");
-        out.println("<a href=\"/examples/servlets/index.html\">");
-        out.println("<img src=\"/examples/images/return.gif\" height=24 " +
+        out.println("<a href=\"../servlets/index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"return\"></a>");
 
         out.println("<h3>" + title + "</h3>");
Index: webapps/examples/WEB-INF/classes/RequestInfoExample.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/RequestInfoExample.java,v

retrieving revision 1.1
diff -u -r1.1 RequestInfoExample.java
--- webapps/examples/WEB-INF/classes/RequestInfoExample.java    17 Aug 2000 00:57:53 
-0000      1.1
+++ webapps/examples/WEB-INF/classes/RequestInfoExample.java    31 Jan 2002 02:33:45 
+-0000
@@ -39,15 +39,11 @@
         // 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=\"/examples/servlets/reqinfo.html\">");
-        out.println("<img src=\"/examples/images/code.gif\" height=24 " +
+        out.println("<a href=\"../servlets/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=\"/examples/servlets/index.html\">");
-        out.println("<img src=\"/examples/images/return.gif\" height=24 " +
+        out.println("<a href=\"../servlets/index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"return\"></a>");
 
         out.println("<h3>" + title + "</h3>");
Index: webapps/examples/WEB-INF/classes/RequestParamExample.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/RequestParamExample.java,v

retrieving revision 1.1
diff -u -r1.1 RequestParamExample.java
--- webapps/examples/WEB-INF/classes/RequestParamExample.java   17 Aug 2000 00:57:53 
-0000      1.1
+++ webapps/examples/WEB-INF/classes/RequestParamExample.java   31 Jan 2002 02:33:48 
+-0000
@@ -40,16 +40,12 @@
         // 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=\"/examples/servlets/reqparams.html\">");
-        out.println("<img src=\"/examples/images/code.gif\" height=24 " +
+        out.println("<a href=\"../servlets/reqparams.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"view code\"></a>");
-        out.println("<a href=\"/examples/servlets/index.html\">");
-        out.println("<img src=\"/examples/images/return.gif\" height=24 " +
+        out.println("<a href=\"../servlets/index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"return\"></a>");
 
         out.println("<h3>" + title + "</h3>");
Index: webapps/examples/WEB-INF/classes/SessionExample.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/WEB-INF/classes/SessionExample.java,v

retrieving revision 1.1
diff -u -r1.1 SessionExample.java
--- webapps/examples/WEB-INF/classes/SessionExample.java        17 Aug 2000 00:57:53 
-0000      1.1
+++ webapps/examples/WEB-INF/classes/SessionExample.java        31 Jan 2002 02:33:49 
+-0000
@@ -38,16 +38,12 @@
 
         // 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=\"/examples/servlets/sessions.html\">");
-        out.println("<img src=\"/examples/images/code.gif\" height=24 " +
+        out.println("<a href=\"../servlets/sessions.html\">");
+        out.println("<img src=\"../images/code.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"view code\"></a>");
-        out.println("<a href=\"/examples/servlets/index.html\">");
-        out.println("<img src=\"/examples/images/return.gif\" height=24 " +
+        out.println("<a href=\"../servlets/index.html\">");
+        out.println("<img src=\"../images/return.gif\" height=24 " +
                     "width=24 align=right border=0 alt=\"return\"></a>");
 
         out.println("<h3>" + title + "</h3>");
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to