int jarFilesLength = jarFiles.length;
int repositoriesLength = repositories.length;
int i;
Resource resource = null;
boolean fileNeedConvert = false;
for (i = 0; (entry == null) && (i < repositoriesLength); i++) {
try {
String fullPath = repositories[i] + path;
Object lookupResult = resources.lookup(fullPath);
if (lookupResult instanceof Resource) {
resource = (Resource) lookupResult;
}
// Note : Not getting an exception here means the resource was
// found
ResourceAttributes attributes =
(ResourceAttributes) resources.getAttributes(fullPath);
contentLength = (int) attributes.getContentLength();
String canonicalPath = attributes.getCanonicalPath();
if (canonicalPath != null) {
// we create the ResourceEntry based on the information returned
// by the DirContext rather than just using the path to the
// repository. This allows to have smart DirContext implementations
// that "virtualize" the docbase (e.g. Eclipse WTP)
entry = findResourceInternal(new File(canonicalPath), "");
} else {
// probably a resource not in the filesystem (e.g. in a
// packaged war)
entry = findResourceInternal(files[i], path);
}
entry.lastModified = attributes.getLastModified();
if (resource != null) {
try {
binaryStream = resource.streamContent();
} catch (IOException e) {
return null;
}
if (needConvert) {