Avoid pattern misdetection in Tomcat "war:" URL separator

Issue: SPR-15332
This commit is contained in:
Juergen Hoeller 2017-03-16 18:55:49 +01:00
parent f6e2c585c8
commit 012c56a1f0
1 changed files with 4 additions and 3 deletions

View File

@ -284,9 +284,10 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
}
}
else {
// Only look for a pattern after a prefix here
// (to not get fooled by a pattern symbol in a strange prefix).
int prefixEnd = locationPattern.indexOf(":") + 1;
// Generally only look for a pattern after a prefix here,
// and on Tomcat only after the "*/" separator for its "war:" protocol.
int prefixEnd = (locationPattern.startsWith("war:") ? locationPattern.indexOf("*/") + 1 :
locationPattern.indexOf(":") + 1);
if (getPathMatcher().isPattern(locationPattern.substring(prefixEnd))) {
// a file pattern
return findPathMatchingResources(locationPattern);