*/
public static UrlTransformer getUrlChomper(final URL rootUrl, final String metadataPath) {
final String rootUrlPattern = '^' + Pattern.quote(rootUrl.toExternalForm()) + "/*";
final String pathFromMetadataToRoot = getPathToRoot(metadataPath);
return new UrlTransformer()
{
public String transform(final URL url) {
return url.toExternalForm().replaceFirst(rootUrlPattern, pathFromMetadataToRoot);
}
};