enumeration = Collections.enumeration(list);
}
// rewriteUrl(contextPath) is expensive. cache result for later reuse
String rewrittenContextPath = rewriteUrl(contextPath);
HtmlEntityEncoder htmlEntityEncoder = new HtmlEntityEncoder();
while (enumeration.hasMoreElements()) {
NameClassPair ncPair = enumeration.nextElement();
String resourceName = ncPair.getName();
String trimmed = resourceName/*.substring(trim)*/;
if (trimmed.equalsIgnoreCase("WEB-INF") ||
trimmed.equalsIgnoreCase("META-INF") ||
trimmed.equalsIgnoreCase(localXsltFile))
continue;
CacheEntry childCacheEntry =
proxyDirContext.lookupCache(cacheEntry.name + resourceName);
if (!childCacheEntry.exists) {
continue;
}
sb.append("<entry");
sb.append(" type='")
.append((childCacheEntry.context != null)?"dir":"file")
.append("'");
sb.append(" urlPath='")
.append(rewrittenContextPath)
.append(rewriteUrl(cacheEntry.name + resourceName))
.append((childCacheEntry.context != null)?"/":"")
.append("'");
if (childCacheEntry.resource != null) {
sb.append(" size='")
.append(renderSize(childCacheEntry.attributes.getContentLength()))
.append("'");
}
sb.append(" date='")
.append(childCacheEntry.attributes.getLastModifiedHttp())
.append("'");
sb.append(">");
sb.append(htmlEntityEncoder.encode(trimmed));
if (childCacheEntry.context != null)
sb.append("/");
sb.append("</entry>");
}