String location = (String)iter.next();
if (location!=null && location.toLowerCase().endsWith(".tld"))
{
if (!location.startsWith("/"))
location="/WEB-INF/"+location;
Resource l=_context.getBaseResource().addPath(location);
tlds.add(l);
}
}
}
// Look for any tlds in WEB-INF directly.
if (_context.getWebInf()!=null)
{
String[] contents = _context.getWebInf().list();
for (int i=0;i<contents.length;i++)
{
if (contents[i]!=null && contents[i].toLowerCase().endsWith(".tld"))
{
Resource l=_context.getWebInf().addPath(contents[i]);
tlds.add(l);
}
}
// Look for any tlds in the META-INF of included jars
Resource lib=_context.getWebInf().addPath("lib/");
if (lib.exists() && lib.isDirectory())
{
contents = lib.list();
for (int i=0;i<contents.length;i++)
{
if (contents[i]!=null && contents[i].toLowerCase().endsWith(".jar"))
{
Resource l=lib.addPath(contents[i]);
Resource meta=Resource.newResource("jar:"+l+"!/META-INF/");
if (meta.exists())
{
String[] meta_contents=meta.list();
for (int j=0;j<meta_contents.length;j++)
{
if (meta_contents[j]!=null && meta_contents[j].toLowerCase().endsWith(".tld"))
{
Resource t=meta.addPath(meta_contents[j]);
tlds.add(t);
}
}
}
}
}
}
}
// Create a TLD parser
XmlParser parser = new XmlParser(false);
parser.redirectEntity("web-jsptaglibrary_1_1.dtd",WebApplicationContext.class.getResource("/javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd"));
parser.redirectEntity("web-jsptaglibrary_1_2.dtd",WebApplicationContext.class.getResource("/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd"));
parser.redirectEntity("web-jsptaglibrary_2_0.xsd",WebApplicationContext.class.getResource("/javax/servlet/jsp/resources/web-jsptaglibrary_2_0.xsd"));
parser.setXpath("/taglib/listener/listener-class");
// Parse all the discovered TLDs
Iterator iter = tlds.iterator();
while (iter.hasNext())
{
try
{
Resource tld = (Resource)iter.next();
if (log.isDebugEnabled()) log.debug("TLD="+tld);
XmlParser.Node root = parser.parse(tld.getURL());
for (int i=0;i<root.size();i++)
{
Object o=root.get(i);
if (o instanceof XmlParser.Node)