// Else, if trackback verification is on...
else if (RollerRuntimeConfig.getBooleanProperty(
"site.trackbackVerification.enabled")) {
// ...ensure trackbacker actually links to us
RollerContext rctx= RollerContext.getRollerContext();
String absurl = rctx.getAbsoluteContextUrl(req);
LinkbackExtractor linkback = new LinkbackExtractor(
comment.getUrl(), absurl + entry.getPermaLink());
if (linkback.getExcerpt() == null) {
comment.setPending(Boolean.TRUE);
comment.setApproved(Boolean.FALSE);
verified = false;
// if we can't verify trackback, then reject it
error = "REJECTED: trackback failed verification";
logger.debug("Trackback failed verification: "+comment.getUrl());
}
}
if (error == null) {
// If comment moderation is on, set comment as pending
if (verified && website.getCommentModerationRequired()) {
comment.setPending(Boolean.TRUE);
comment.setApproved(Boolean.FALSE);
} else if (verified) {
comment.setPending(Boolean.FALSE);
comment.setApproved(Boolean.TRUE);
}
// save, commit, send response
WeblogManager mgr = RollerFactory.getRoller().getWeblogManager();
mgr.saveComment(comment);
RollerFactory.getRoller().flush();
// Clear all caches associated with comment
CacheManager.invalidate(comment);
// Send email notifications
RollerContext rc = RollerContext.getRollerContext();
String rootURL = rc.getAbsoluteContextUrl(req);
if (rootURL == null || rootURL.trim().length()==0) {
rootURL = RequestUtils.serverURL(req) + req.getContextPath();
}
CommentServlet.sendEmailNotification(comment, rootURL);