Bug 62968 - Avoid unnecessary call to WebResourceRoot.getResource in Mapper.internalMapWrapper
Summary: Avoid unnecessary call to WebResourceRoot.getResource in Mapper.internalMapWr...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 9.0.x
Hardware: PC Mac OS X 10.1
: P2 normal with 1 vote (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-30 13:14 UTC by Andy Wilkinson
Modified: 2019-01-16 07:03 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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)