int size = _ruleList.size();
if (size <= index)
return next;
DispatchRule firstRule = _ruleList.get(index);
uri = firstRule.rewriteUri(uri, queryString);
// scan unless the URI is rewritten, then force recursion
int tail = index + 1;
for (; tail < size; tail++) {
DispatchRule uriRule = _ruleList.get(tail);
String newUri = uriRule.rewriteUri(uri, queryString);
if (newUri != uri) {
next = mapChain(tail, type, uri, queryString, chain);
break;
}
}
for (int i = tail - 1; index <= i; i--) {
DispatchRule rule = _ruleList.get(i);
next = rule.map(type, uri, queryString, next, chain);
}
return next;
}