protected void rewriteLink(AttributesImpl newAttrs, Document targetDocument, String anchor, String queryString)
throws AccessControlException, PublicationException {
String webappUrl = targetDocument.getCompleteURL();
Policy policy = this.policyManager.getPolicy(this.accreditableManager, webappUrl);
Proxy proxy = targetDocument.getPublication().getProxy(targetDocument, policy.isSSLProtected());
String rewrittenURL;
if (proxy == null) {
rewrittenURL = this.request.getContextPath() + webappUrl;
} else {
rewrittenURL = proxy.getURL(targetDocument);
}
if (anchor != null) {
rewrittenURL += "#" + anchor;
}