On Thu, May 8, 2025 at 6:04 PM Christopher Schultz < ch...@christopherschultz.net> wrote:
> Jakub, > > On 5/7/25 3:26 PM, Jakub Królikowski wrote: > > On Sat, Apr 29, 2017 at 12:01 PM Mark Thomas <ma...@apache.org> wrote: > > > >> On 28/04/17 17:00, Matt Cosentino wrote: > >>> Yes, it's other folders within WEB-INF. I turned on the TldScanner > >>> logging and it is definitely what is causing the delay. My situation > >>> probably isn't very typical. The delay varies in my various web > >>> applications, the worst being about 20 seconds. It all adds up > >>> though, and every second counts when our sites are down. > >> > >> There is a solution available but it is intended more for the embedded > >> use case rather than a standard Tomcat install. Using it in a standard > >> install would require (effectively) patching Tomcat. > >> > >> The general idea would be to use the TldPreScanned class. That does > >> require all the TLDs to be listed in advance. On the plus side, no > >> scanning delay. On the down side, adding TLDs requires code changes. > >> Doing this with a standard Tomcat install requires changes to the > >> JasperInitializer (hence the patch). I don't think there is a pure > >> config way around that but I'll look into it. > >> > >> A better solution would probably be to make it easier to plugin in a > >> custom TLDScanner - i.e. purely with config. If you'd like us to explore > >> this option we should re-open 61052 and adjust accordingly. I don't > >> think there is enough demand for filtering resource paths to make that > >> worth implementing. > >> > >> One final thought. Are you running the web application from a WAR or an > >> expanded directory? (The latter would be faster). > >> > >> Mark > >> > > > > > > Hello, > > > > I reorganized the code of my web app and I moved all views (mainly .jsp > > files) to WEB-INF/view folder. > > This means that the WEB-INF/view folder is scanned recursively for TLD > > files. And it takes some time... > > I am very interested in using the TldPreScanned class, which I see has > been > > implemented. > > How can it be used? > > Looks like you just mention the class in your JarScanner element (which > probably doesn't exist, so you will have to add configuration to change > from the defaults). > > https://tomcat.apache.org/tomcat-9.0-doc/config/jar-scanner.html > > > I think it would be very useful to have a feature in the Tomcat > > configuration > > to specify a custom class for scanning TLDs > > or to skip specific folders from WEB-INF from scanning. > > The above documentation shows that JarScanning is already completely > pluggable. > > There is also > https://tomcat.apache.org/tomcat-9.0-doc/config/jar-scan-filter.html > > -chris > Hi Christopher, JarScanning indeed is completely pluggable and I successfully configured it in my context.xml file. However, TldScanner does something more, as far as I understand. TldScanner scans all subfolders in WEB-INF, jars with JarScanner are scanned at the end. It's hardcoded in org.apache.jasper.servlet.TldScanner: public void scan() throws IOException, SAXException { scanPlatform(); scanJspConfig(); *scanResourcePaths(WEB_INF);* scanJars(); } > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > Best regards, -- Jakub Królikowski +49 162 6400341