Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 82017 invoked from network); 7 Jan 2003 15:56:26 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 7 Jan 2003 15:56:26 -0000 Received: (qmail 10346 invoked by uid 97); 7 Jan 2003 15:57:37 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@jakarta.apache.org Received: (qmail 10311 invoked by uid 97); 7 Jan 2003 15:57:36 -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 10299 invoked by uid 98); 7 Jan 2003 15:57:35 -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: <3E1ABCBD.1030104@apache.org> References: <66337F04F2A1E440BF87F2080B5F537001481717@madison.dc.Blackboard.com> <1041901840.21193.229.camel@localhost.localdomain> <1041903196.21193.243.camel@localhost.localdomain> <3E1ABCBD.1030104@apache.org> Content-Type: text/plain Organization: Message-Id: <1041955142.1860.3.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 07 Jan 2003 08:59:02 -0700 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 07 Jan 2003 15:56:16.0429 (UTC) FILETIME=[4FAA05D0:01C2B665] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Tue, 2003-01-07 at 04:40, Remy Maucherat wrote: > I'll -1 this patch unless the new behavior is made optional (and default > to the current behavior). > > Remy Okay, it's now an init param which defaults to false. Following are DefaultServlet.java and web.xml patches. --- DefaultServlet.java.orig 2003-01-07 08:41:16.000000000 -0700 +++ DefaultServlet.java 2003-01-07 08:42:33.000000000 -0700 @@ -169,6 +169,10 @@ */ protected String welcomes[] = new String[0]; + /** + * Should we redirect or forward for welcome files? + */ + protected boolean forwardWelcomeFiles = false; /** * MD5 message digest provider. @@ -294,6 +298,13 @@ } catch (Throwable t) { ; } + try { + value = getServletConfig().getInitParameter("forwardWelcomeFiles"); + if (value != null) + forwardWelcomeFiles = (new Boolean(value)).booleanValue(); + } catch (Throwable t) { + ; + } // Sanity check on the specified buffer sizes if (input < 256) @@ -957,11 +968,16 @@ if (welcomeFileInfo != null) { String redirectPath = welcomeFileInfo.path; String contextPath = request.getContextPath(); - if ((contextPath != null) && (!contextPath.equals("/"))) { + if ((contextPath != null) && (!contextPath.equals("/")) && (!forwardWelcomeFiles)) { redirectPath = contextPath + redirectPath; } redirectPath = appendParameters(request, redirectPath); - response.sendRedirect(redirectPath); + if (forwardWelcomeFiles) { + request.getRequestDispatcher(redirectPath).forward(request, response); + } + else { + response.sendRedirect(redirectPath); + } return; } --- web.xml.orig 2003-01-07 08:58:09.000000000 -0700 +++ web.xml 2003-01-07 08:50:13.000000000 -0700 @@ -39,6 +39,9 @@ + + + default -- To unsubscribe, e-mail: For additional commands, e-mail: