|
36 | 36 | import javax.servlet.ServletContext;
|
37 | 37 | import java.net.MalformedURLException;
|
38 | 38 | import java.util.*;
|
| 39 | +import java.net.URL; |
| 40 | +import java.util.Collections; |
| 41 | +import java.util.HashMap; |
| 42 | +import java.util.LinkedHashMap; |
| 43 | +import java.util.List; |
| 44 | +import java.util.Map; |
39 | 45 |
|
40 | 46 | /**
|
41 | 47 | * <p>
|
@@ -313,16 +319,18 @@ protected Result findResult(String path, String resultCode, String ext, ActionCo
|
313 | 319 | try {
|
314 | 320 | LOG.trace("Checking ServletContext for {}", path);
|
315 | 321 |
|
316 |
| - if (servletContext.getResource(path) != null) { |
317 |
| - LOG.trace("Found"); |
| 322 | + URL resource = servletContext.getResource(path); |
| 323 | + if (resource != null && resource.getPath().endsWith(path)) { |
| 324 | + LOG.trace("Found resource {}", resource); |
318 | 325 | return buildResult(path, resultCode, resultsByExtension.get(ext), actionContext);
|
319 | 326 | }
|
320 | 327 |
|
321 | 328 | LOG.trace("Checking ClassLoader for {}", path);
|
322 | 329 |
|
323 | 330 | String classLoaderPath = path.startsWith("/") ? path.substring(1, path.length()) : path;
|
324 |
| - if (ClassLoaderUtil.getResource(classLoaderPath, getClass()) != null) { |
325 |
| - LOG.trace("Found"); |
| 331 | + resource = ClassLoaderUtil.getResource(classLoaderPath, getClass()); |
| 332 | + if (resource != null && resource.getPath().endsWith(classLoaderPath)) { |
| 333 | + LOG.trace("Found resource {}", resource); |
326 | 334 | return buildResult(path, resultCode, resultsByExtension.get(ext), actionContext);
|
327 | 335 | }
|
328 | 336 | } catch (MalformedURLException e) {
|
|
0 commit comments