Author: remy.maucherat(a)jboss.com
Date: 2008-11-12 10:12:35 -0500 (Wed, 12 Nov 2008)
New Revision: 855
Modified:
trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
trunk/webapps/docs/changelog.xml
Log:
- 42673: Port SSI fix.
Modified: trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
===================================================================
--- trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java 2008-11-12 15:07:26
UTC (rev 854)
+++ trunk/java/org/apache/catalina/ssi/SSIServletExternalResolver.java 2008-11-12 15:12:35
UTC (rev 855)
@@ -353,14 +353,12 @@
}
- protected String getPathWithoutContext(String servletPath) {
- String retVal = null;
- int secondSlash = servletPath.indexOf('/', 1);
- if (secondSlash >= 0) {
- //cut off context
- retVal = servletPath.substring(secondSlash);
+ protected String getPathWithoutContext(final String contextPath,
+ final String servletPath) {
+ if (servletPath.startsWith(contextPath)) {
+ return servletPath.substring(contextPath.length());
}
- return retVal;
+ return servletPath;
}
@@ -419,7 +417,8 @@
// ie:
// '/file1.shtml' vs '/appName1/file1.shtml'
if (!isRootContext(normContext)) {
- String noContext = getPathWithoutContext(normalized);
+ String noContext = getPathWithoutContext(
+ normContext.getContextPath(), normalized);
if (noContext == null) {
throw new IOException(
"Couldn't remove context from path: "
@@ -571,4 +570,4 @@
return path;
}
}
-}
\ No newline at end of file
+}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-11-12 15:07:26 UTC (rev 854)
+++ trunk/webapps/docs/changelog.xml 2008-11-12 15:12:35 UTC (rev 855)
@@ -32,6 +32,10 @@
<fix>
<bug>42747</bug>: Harmonize handling of context.xml between war and
exploded folder. (markt)
</fix>
+ <fix>
+ <bug>42673</bug>: In SSI, correctly handle includes with multi-level
contexts.
+ Patch provided by Peter Jodeleit. (markt)
+ </fix>
</changelog>
</subsection>
</section>
Show replies by date