1 19 20 package com.sslexplorer.navigation; 21 22 import javax.servlet.ServletException ; 23 import javax.servlet.http.HttpServletRequest ; 24 import javax.servlet.http.HttpServletResponse ; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 import org.apache.struts.action.ActionForm; 29 import org.apache.struts.action.ActionForward; 30 import org.apache.struts.action.ActionMapping; 31 import org.apache.struts.config.ExceptionConfig; 32 33 import com.sslexplorer.core.PopupException; 34 import com.sslexplorer.security.Constants; 35 36 37 43 public class ExceptionHandler extends org.apache.struts.action.ExceptionHandler { 44 45 final static Log log = LogFactory.getLog(ExceptionHandler.class); 46 47 57 public ActionForward execute(Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, 58 HttpServletRequest request, HttpServletResponse response) throws ServletException { 59 log.error("An error occured during action processing. ", ex); 60 if (ex instanceof PopupException) { 61 request.getSession().setAttribute(Constants.EXCEPTION, ex.getCause()); 62 return mapping.findForward("popupException"); 63 } else { 64 request.getSession().setAttribute(Constants.EXCEPTION, ex); 65 return mapping.findForward("exception"); 66 } 67 } 68 } 69 | Popular Tags |