public ActionForward execute(
ActionMapping mapping, ActionForm form,
HttpServletRequest req, HttpServletResponse res)
throws Exception
{
WeblogEntryData entry = null;
RollerRequest rreq = RollerRequest.getRollerRequest(req);
RollerSession rollerSession = RollerSession.getRollerSession(req);
try
{
if (rreq.getWebsite() != null
&& rollerSession.isUserAuthorizedToAuthor(rreq.getWebsite()) )
{
String refid = req.getParameter(RequestConstants.REFERRER_ID);
if ( refid != null )
{
RefererManager refmgr =
RollerFactory.getRoller().getRefererManager();
RefererData ref = refmgr.getReferer(refid);
entry = ref.getWeblogEntry();
boolean was = ref.getVisible()==null ?
false : ref.getVisible().booleanValue();
ref.setVisible(Boolean.valueOf( !was )); // what up, dog?
refmgr.saveReferer(ref);
RollerFactory.getRoller().flush();
//PageCacheFilter.removeFromCache( req, rreq.getWebsite() );
CacheManager.invalidate(rreq.getWebsite());
}
}
}
catch (Exception e)
{
mLogger.error("Toggling linkback display",e);
throw new ServletException(e);
}
// forward back to entry or to blog if we have no entry
String url = null;
try
{
RollerContext rctx = RollerContext.getRollerContext();
if (entry != null) {
url = entry.getPermalink();
} else {
url = rreq.getWebsite().getURL();
}
res.sendRedirect(url);
}