Bug 62968

Summary: Avoid unnecessary call to WebResourceRoot.getResource in Mapper.internalMapWrapper
Product: Tomcat 9 Reporter: Andy Wilkinson <andy.wilkinson>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: it4pradeep, nobeh5
Priority: P2    
Version: 9.0.x   
Target Milestone: -----   
Hardware: PC   
OS: Mac OS X 10.1   

Description Andy Wilkinson 2018-11-30 13:14:34 UTC
When considering rule 7, Mapper.internalMapWrapper makes a call to WebResourceRoot.getResource(String) that is only necessary if Context.getMapperDirectoryRedirectEnabled() returns true. It looks like the logic could be reworked so that enablement of the redirect is checked first, and the getResource(String) call is then only made when it is enabled.

This was originally discussed with Mark Thomas in the context of a Spring Boot issue. Please see https://github.com/spring-projects/spring-boot/issues/8522#issuecomment-443177285 for further details.
Comment 1 Mark Thomas 2018-11-30 21:02:12 UTC
Fixed in:
- trunk for 9.0.14 onwards
- 8.5.x for 8.5.36 onwards

(7.0.x has a different resources implementation)