* @throws Exception
*/
public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception {
RollerRequest rreq = RollerRequest.getRollerRequest(req);
PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
PingTargetForm pingTargetForm = (PingTargetForm) form;
try {
BasePageModel pageModel = new BasePageModel(getPingTargetEditTitle(), req, res, mapping);
req.setAttribute("model", pageModel);
if (!hasRequiredRights(rreq, rreq.getWebsite())) {
return mapping.findForward(ACCESS_DENIED_PAGE);
}
PingTargetData pingTarget = null;
String pingTargetId = pingTargetForm.getId();
if (pingTargetId != null && pingTargetId.length() > 0) {
pingTarget = pingTargetMgr.getPingTarget(pingTargetForm.getId());
if (pingTarget == null) throw new RollerException("No such ping target id: " + pingTargetId);
pingTargetForm.copyTo(pingTarget, req.getLocale());
} else {
pingTarget = createPingTarget(rreq, pingTargetForm);
}
// Call private helper to validate ping target