return new ResourceFilterChain() {
private int i = 0;
public Resource doFilter(ResourceMatchResult filterMatchResult, Set<ResourceLoadingOption> options)
throws ResourceNotFoundException {
ResourceFilter filter;
if (i < filters.length) {
filter = filters[i++];
String resourceName = filterMatchResult.getResourceName();
log.debug("Applying filter to resource \"{}\": {}", resourceName, filter);
return filter.doFilter(filterMatchResult, options, this);
} else {
return root.doFilter(filterMatchResult, options);
}
}
};