DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8099>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8099 DefaultServlet looses query string information in redirect Summary: DefaultServlet looses query string information in redirect Product: Tomcat 4 Version: 4.0.3 Final Platform: All OS/Version: All Status: NEW Severity: Major Priority: Other Component: Catalina AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] (Applies also to Tomcat 3.2 / 3.3) If Tomcat us running standalone the DefaultServlet serves also the welcome pages. To do this it does a redirect to the welcome page, e.g.: http://localhost/ is redirected to: http://localhost/index.html The problem is if a query string is present only the information of the query string which is of the type "param1=attr1&...¶mN=attrN" is redirected. If am doing something like: http://localhost/?20 the result is: http://localhost/index.html and not: http://localhost/index.html?20 Neither the URL specification (RFC1738) nor the HTTP specification states that the query string must be of the form "param1=attr1&...¶mN=attrN". I did a simple patch to the DefaultServlet which simply adds the query string to the redirect, which is also simpler and faster: protected String appendParameters(HttpServletRequest request, String redirectPath) { StringBuffer result = new StringBuffer(rewriteUrl(redirectPath)); // PATCHED String query = request.getQueryString (); if (query != null) result.append ("?").append (query); /* Enumeration enum = request.getParameterNames(); if (enum.hasMoreElements()) result.append("?"); while (enum.hasMoreElements()) { String name = (String) enum.nextElement(); String[] values = request.getParameterValues(name); for (int i = 0; i < values.length; i++) { result.append(rewriteUrl(name)); result.append("="); result.append(rewriteUrl(values[i])); if (i < (values.length - 1)) result.append("&"); } if (enum.hasMoreElements()) result.append("&"); }*/ return result.toString(); } By the way I did also a patch which serves the welcome page directly instead of doing a redirect (This is also the behaviour of the Apache Web Server). To do this replace line 1087ff of DefaultServlet.java: redirectPath = appendParameters(request, redirectPath); response.sendRedirect(redirectPath); return; with resourceInfo.set (redirectPath, resources); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>