DocumentBuilder builder = pub.getDocumentBuilder();
String oldTargetUrl = builder.buildCanonicalUrl(pub, getArea(), getOldDocumentId());
Document oldTargetDocument = builder.buildDocument(pub, oldTargetUrl);
String newTargetUrl = builder.buildCanonicalUrl(pub, getArea(), getNewDocumentId());
Document newTargetDocument = builder.buildDocument(pub, newTargetUrl);
LinkRewriter rewriter = new LinkRewriter();
rewriter.rewriteLinks(oldTargetDocument, newTargetDocument, getContextPrefix());