01: package org.claros.mini.actions;
02:
03: import javax.servlet.http.HttpServletRequest;
04: import javax.servlet.http.HttpServletResponse;
05:
06: import org.apache.commons.logging.Log;
07: import org.apache.commons.logging.LogFactory;
08: import org.apache.struts.action.ActionForm;
09: import org.apache.struts.action.ActionForward;
10: import org.apache.struts.action.ActionMapping;
11: import org.claros.commons.exception.ClarosBaseException;
12: import org.claros.mini.common.BaseClarosAction;
13:
14: /**
15: * @author Umut Gokbayrak
16: */
17: public class GeneralErrorAction extends BaseClarosAction {
18: private static Log log = LogFactory
19: .getLog(GeneralErrorAction.class);
20:
21: /* (non-Javadoc)
22: * @see org.claros.mini.common.BaseClarosAction#myExecute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
23: */
24: public ActionForward myExecute(ActionMapping mapping,
25: ActionForm form, HttpServletRequest request,
26: HttpServletResponse response) throws Exception {
27: ActionForward forward = mapping.findForward("error");
28:
29: Object e = request.getAttribute("myexception");
30: if (e != null) {
31: if (e instanceof ClarosBaseException) {
32: ClarosBaseException myEx = (ClarosBaseException) e;
33: log.error(myEx);
34: }
35: }
36: return forward;
37: }
38:
39: }
|