// If the URL possibly is to be rewritten using page URI
// rewriter, rewrite the URL in-place, since at the moment the
// getUrl() method would be invoked, the page context would
// change and the page URI rewriter would return different
// result than expected.
url = assetResolver.rewriteURLWithPageURLRewriter(url, PageURLType.ANCHOR);
try {
url = uriRewriter.rewrite(new URI(url), PageURLType.ANCHOR).toString();
} catch (URISyntaxException e) {
throw new XDIMEException("Invalid URI: " + url, e);