From 55d28cc11ae8e5fccf751a4deba14df2677cc983 Mon Sep 17 00:00:00 2001 From: funkman Date: Mon, 31 Aug 2009 13:59:00 +0000 Subject: [PATCH] Allow welcome files without a physical backing. Inspired by this bug https://issues.apache.org/bugzilla/show_bug.cgi?id=47378 git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@809596 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tomcat/util/http/mapper/Mapper.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/java/org/apache/tomcat/util/http/mapper/Mapper.java b/java/org/apache/tomcat/util/http/mapper/Mapper.java index 1d34bbb4d..2327868f9 100644 --- a/java/org/apache/tomcat/util/http/mapper/Mapper.java +++ b/java/org/apache/tomcat/util/http/mapper/Mapper.java @@ -804,6 +804,36 @@ public final class Mapper { } + /* welcome file processing - take 2 + * Now that we have looked for welcome files with a physical + * backing, now look for an extension mapping listed + * but may not have a physical backing to it. This is for + * the case of index.jsf, index.do, etc. + * A watered down version of rule 4 + */ + if (mappingData.wrapper == null) { + boolean checkWelcomeFiles = checkJspWelcomeFiles; + if (!checkWelcomeFiles) { + char[] buf = path.getBuffer(); + checkWelcomeFiles = (buf[pathEnd - 1] == '/'); + } + if (checkWelcomeFiles) { + for (int i = 0; (i < context.welcomeResources.length) + && (mappingData.wrapper == null); i++) { + path.setOffset(pathOffset); + path.setEnd(pathEnd); + path.append(context.welcomeResources[i], 0, + context.welcomeResources[i].length()); + path.setOffset(servletPath); + internalMapExtensionWrapper(extensionWrappers, + path, mappingData); + } + + path.setOffset(servletPath); + path.setEnd(pathEnd); + } + } + // Rule 7 -- Default servlet if (mappingData.wrapper == null && !checkJspWelcomeFiles) { -- 2.11.0