Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 17178 invoked from network); 7 Jan 2003 01:30:52 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 7 Jan 2003 01:30:52 -0000 Received: (qmail 18622 invoked by uid 97); 7 Jan 2003 01:31:56 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@jakarta.apache.org Received: (qmail 18557 invoked by uid 97); 7 Jan 2003 01:31:55 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 18491 invoked by uid 98); 7 Jan 2003 01:31:54 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Subject: RE: [PATCH] forward instead of redirect for welcome files From: Matt Parker To: Tomcat Developers List In-Reply-To: <1041901840.21193.229.camel@localhost.localdomain> References: <66337F04F2A1E440BF87F2080B5F537001481717@madison.dc.Blackboard.com> <1041901840.21193.229.camel@localhost.localdomain> Content-Type: text/plain Organization: Message-Id: <1041903196.21193.243.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 06 Jan 2003 18:33:16 -0700 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 07 Jan 2003 01:30:34.0402 (UTC) FILETIME=[5FCDB020:01C2B5EC] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Here's the new version of the patch. the code to redirect if there is no trailing slash remains untouched, but it now forwards if there is a trailing slash. i've included more context to avoid potential confusion: --- DefaultServlet.java 2003-01-03 16:20:23.000000000 -0700 +++ DefaultServlet.java.new 2003-01-06 18:27:25.000000000 -0700 @@ -939,46 +939,42 @@ // If the resource is a collection (aka a directory), we check // the welcome files list. if (resourceInfo.collection) { if (!request.getRequestURI().endsWith("/")) { String redirectPath = path; String contextPath = request.getContextPath(); if ((contextPath != null) && (!contextPath.equals("/"))) { redirectPath = contextPath + redirectPath; } if (!(redirectPath.endsWith("/"))) redirectPath = redirectPath + "/"; redirectPath = appendParameters(request, redirectPath); response.sendRedirect(redirectPath); return; } ResourceInfo welcomeFileInfo = checkWelcomeFiles(path, resources); if (welcomeFileInfo != null) { String redirectPath = welcomeFileInfo.path; - String contextPath = request.getContextPath(); - if ((contextPath != null) && (!contextPath.equals("/"))) { - redirectPath = contextPath + redirectPath; - } redirectPath = appendParameters(request, redirectPath); - response.sendRedirect(redirectPath); + request.getRequestDispatcher(redirectPath).forward(request, response); return; } } else { // Checking If headers boolean included = (request.getAttribute(Globals.CONTEXT_PATH_ATTR) != null); if (!included && !checkIfHeaders(request, response, resourceInfo)) { return; } } // Find content type. String contentType = getServletContext().getMimeType(resourceInfo.path); Vector ranges = null; -- To unsubscribe, e-mail: For additional commands, e-mail: