gianugo 2002/12/13 01:02:19
Modified: java/src/org/apache/xindice/server XindiceServlet.java Log: Patch by Michael Westbay ([EMAIL PROTECTED]) removing hardcoded paths from the debug tool. Revision Changes Path 1.10 +15 -9 xml-xindice/java/src/org/apache/xindice/server/XindiceServlet.java Index: XindiceServlet.java =================================================================== RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/server/XindiceServlet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- XindiceServlet.java 30 Nov 2002 18:32:07 -0000 1.9 +++ XindiceServlet.java 13 Dec 2002 09:02:19 -0000 1.10 @@ -263,21 +263,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>"); } @@ -297,11 +299,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) { @@ -314,7 +317,8 @@ return result.toString(); } - protected String getHierarchy(XPathPseudoParser parser) + protected String getHierarchy(XPathPseudoParser parser, + String contextPath) throws DBException, Exception { StringBuffer result = new StringBuffer(); @@ -334,7 +338,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("\">"); @@ -345,7 +350,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("\">");