private void addTldLocationsFromServletContextJar(final String jarResourcePath) throws IOException, MalformedURLException, SAXException {
  final String metaInfEntryPath=normalizeJarEntryPath(META_INF_ABS_PATH,true);
  final JarFile jarFile=servletContextResourceToFileOrNull(jarResourcePath);
  if (jarFile != null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Scanning for " + META_INF_ABS_PATH + "*.tld-s in JarFile: servletContext:"+ jarResourcePath);
    }
    for (Enumeration entries=jarFile.entries(); entries.hasMoreElements(); ) {
      final JarEntry curEntry=(JarEntry)entries.nextElement();
      final String curEntryPath=normalizeJarEntryPath(curEntry.getName(),false);
      if (curEntryPath.startsWith(metaInfEntryPath) && curEntryPath.endsWith(".tld")) {
        addTldLocationFromTld(new ServletContextJarEntryTldLocation(jarResourcePath,curEntryPath));
      }
    }
  }
 else {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Scanning for " + META_INF_ABS_PATH + "*.tld-s in ZipInputStream (slow): servletContext:"+ jarResourcePath);
    }
    final InputStream in=servletContext.getResourceAsStream(jarResourcePath);
    if (in == null) {
      throw new IOException("ServletContext resource not found: " + jarResourcePath);
    }
    try {
      ZipInputStream zipIn=new ZipInputStream(in);
      try {
        while (true) {
          ZipEntry curEntry=zipIn.getNextEntry();
          if (curEntry == null)           break;
          String curEntryPath=normalizeJarEntryPath(curEntry.getName(),false);
          if (curEntryPath.startsWith(metaInfEntryPath) && curEntryPath.endsWith(".tld")) {
            addTldLocationFromTld(zipIn,new ServletContextJarEntryTldLocation(jarResourcePath,curEntryPath));
          }
        }
      }
  finally {
        zipIn.close();
      }
    }
  finally {
      in.close();
    }
  }
}

private void addTldLocationsFromServletContextJar ( final String jarResourcePath ) throws IOException , MalformedURLException , SAXException { final String metaInfEntryPath = normalizeJarEntryPath ( META_INF_ABS_PATH , true ) ; final JarFile jarFile = servletContextResourceToFileOrNull ( jarResourcePath ) ; if ( jarFile != null ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Scanning for " + META_INF_ABS_PATH + "*.tld-s in JarFile: servletContext:" + jarResourcePath ) ; } for ( Enumeration entries = jarFile . entries ( ) ; entries . hasMoreElements ( ) ; ) { final JarEntry curEntry = ( JarEntry ) entries . nextElement ( ) ; final String curEntryPath = normalizeJarEntryPath ( curEntry . getName ( ) , false ) ; if ( curEntryPath . startsWith ( metaInfEntryPath ) && curEntryPath . endsWith ( ".tld" ) ) { addTldLocationFromTld ( new ServletContextJarEntryTldLocation ( jarResourcePath , curEntryPath ) ) ; } } } else { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Scanning for " + META_INF_ABS_PATH + "*.tld-s in ZipInputStream (slow): servletContext:" + jarResourcePath ) ; } final InputStream in = servletContext . getResourceAsStream ( jarResourcePath ) ; if ( in == null ) { throw new IOException ( "ServletContext resource not found: " + jarResourcePath ) ; } try { ZipInputStream zipIn = new ZipInputStream ( in ) ; try { while ( true ) { ZipEntry curEntry = zipIn . getNextEntry ( ) ; if ( curEntry == null ) break ; String curEntryPath = normalizeJarEntryPath ( curEntry . getName ( ) , false ) ; if ( curEntryPath . startsWith ( metaInfEntryPath ) && curEntryPath . endsWith ( ".tld" ) ) { addTldLocationFromTld ( zipIn , new ServletContextJarEntryTldLocation ( jarResourcePath , curEntryPath ) ) ; } } } finally { zipIn . close ( ) ; } } finally { in . close ( ) ; } } }
finds and processes * . tld inside a jar in the servet context .
