Gianugo Rabellino-san wrote:

> I have a fix ready to commit about the database root directory issue. I
> would go ahead but, since it's touching a core aspect of the upcoming
> release I'd like some feedback about it before changing the code.
>
> [snip]

+1.  Works for me.  I think you took care of all of the issues.

P.S.  I think my patch for the fixed context name problem got lost in
      the discussion about the root directory.  Will you be merging with
      it?  Or was the patch rejected?

-- 
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:           http://www.seaple.icc.ne.jp/~westbay
Commentary:     http://www.japanesebaseball.com/forum/
Index: java/src/org/apache/xindice/server/XindiceServlet.java
===================================================================
RCS file: /home/cvspublic/xml-xindice/java/src/org/apache/xindice/server/XindiceServlet.java,v
retrieving revision 1.7
diff -u -r1.7 XindiceServlet.java
--- java/src/org/apache/xindice/server/XindiceServlet.java	17 Nov 2002 20:32:47 -0000	1.7
+++ java/src/org/apache/xindice/server/XindiceServlet.java	26 Nov 2002 13:29:15 -0000
@@ -212,21 +212,23 @@
                      HttpServletResponse response)
          throws ServletException, IOException {
       try {
+	 String contextPath = request.getContextPath();
          StringBuffer sb = new StringBuffer();
          String path = request.getQueryString();
          sb.append("<html><body><center>");
          if (path == null) {
             sb.append("<h2>THIS IS AN UGLY DEBUG TOOL!</h2><p>");
             sb.append("To browse the database, follow the link ");
-            sb.append("<a href=\"Xindice?/" + db.getName() + "\">" + db.getName() + "</a>");
+            sb.append("<a href=\"" + contextPath + "?/" +
+	       db.getName() + "\">" + db.getName() + "</a>");
          } else {
             // we have something to chew on
             XPathPseudoParser parser = new XPathPseudoParser(path);
 
             /* building the page once we have all the information */
             sb.append("<table border=\"1\" width=\"90%\">");
-            sb.append("<tr><td rowspan=\"1\" colspan=\"2\">" + getPathNavigation(parser) + "</td></tr>");
-            sb.append("<tr><td valign=\"top\">" + getHierarchy(parser) + "</td>");
+            sb.append("<tr><td rowspan=\"1\" colspan=\"2\">" + getPathNavigation(parser, contextPath) + "</td></tr>");
+            sb.append("<tr><td valign=\"top\">" + getHierarchy(parser, contextPath) + "</td>");
             sb.append("<td valign=\"top\">" + getDetailView(parser) + "</td></tr>");
             sb.append("</table>");
          }
@@ -246,11 +248,12 @@
       }
    }
 
-   protected String getPathNavigation(XPathPseudoParser parser) {
+   protected String getPathNavigation(XPathPseudoParser parser,
+                                      String contextPath) {
       String path = parser.getQuery();
       StringBuffer result = new StringBuffer();
       StringTokenizer st = new StringTokenizer(path, "/");
-      String currentPath = "<a href=\"Xindice?";
+      String currentPath = "<a href=\"" + contextPath + "?";
       while (st.hasMoreTokens()) {
          String token = st.nextToken();
          if (token.indexOf("&") > 0) {
@@ -263,7 +266,8 @@
       return result.toString();
    }
 
-   protected String getHierarchy(XPathPseudoParser parser)
+   protected String getHierarchy(XPathPseudoParser parser,
+                                 String contextPath)
          throws DBException, Exception {
       StringBuffer result = new StringBuffer();
 
@@ -283,7 +287,8 @@
 
       String[] cols = col.listCollections();
       for (int i = 0; i < cols.length; i++) {
-         result.append("<a href=\"Xindice?" + parser.getDatabase() + "/" + parser.getPath());
+         result.append("<a href=\"" + contextPath + "?" +
+            parser.getDatabase() + "/" + parser.getPath());
          result.append("/");
          result.append(cols[i]);
          result.append("\">");
@@ -294,7 +299,8 @@
       try {
          String[] docs = col.listDocuments();
          for (int i = 0; i < docs.length; i++) {
-            result.append("<a href=\"Xindice?" + parser.getDatabase() + "/" + parser.getPath());
+            result.append("<a href=\"" + contextPath + "?" +
+               parser.getDatabase() + "/" + parser.getPath());
             result.append("&");
             result.append(docs[i]);
             result.append("\">");

Reply via email to