for (int i = 0; iter.hasNext(); i++) {
redirPaths[i] = ((PageInfo) iter.next()).getPath();
}
}
Path result = null;
int best = 0;
if (Utils.searchString(WebUtils.DEFAULT_WELCOME_FILES,
requestedPath.getLastElement(), false) >= 0) {
requestedPath = requestedPath.getPartial(requestedPath.getElementCount() - 1);
}
if (redirCache.containsKey(requestedPath)) {
result = (Path) redirCache.get(requestedPath);
} else {
Path match = removePageExtension(requestedPath);
for (int i = 0; i < redirPaths.length; i++) {
String[] commonPart = Utils.commonPart(match.getElements(),
removePageExtension(redirPaths[i]).getElements(), true);
if (commonPart != null && commonPart.length > best) {
result = redirPaths[i];
best = commonPart.length;