1 3 package com.sslexplorer.core.actions; 4 5 import javax.servlet.http.HttpServletRequest ; 6 import javax.servlet.http.HttpServletResponse ; 7 8 import org.apache.struts.action.ActionForm; 9 import org.apache.struts.action.ActionForward; 10 import org.apache.struts.action.ActionMapping; 11 import org.apache.struts.action.ActionMessages; 12 import org.apache.struts.actions.DispatchAction; 13 14 import com.sslexplorer.boot.ContextHolder; 15 import com.sslexplorer.core.CoreUtil; 16 import com.sslexplorer.security.SessionInfo; 17 18 25 public abstract class DefaultDispatchAction extends DispatchAction implements CoreAction { 26 27 35 public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 36 throws Exception { 37 ActionForward fwd = checkIntercept(mapping, request, response); 38 if (fwd != null) { 39 return fwd; 40 } 41 if (isSetupMode()) { 42 if ((getNavigationContext(mapping, form, request, response) & SessionInfo.SETUP_CONSOLE_CONTEXT) == 0) { 43 return mapping.findForward("setup"); 44 } 45 } 46 return super.execute(mapping, form, request, response); 47 } 48 49 52 public boolean isSetupMode() { 53 return ContextHolder.getContext().isSetupMode(); 54 } 55 56 63 public ActionForward checkIntercept(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response) 64 throws Exception { 65 return CoreUtil.checkIntercept(this, mapping, request, response); 66 } 67 68 74 protected void addWarnings(HttpServletRequest request, ActionMessages warnings) { 75 CoreUtil.addWarnings(request, warnings); 76 } 77 78 84 protected ActionMessages getWarnings(HttpServletRequest request) { 85 return CoreUtil.getWarnings(request); 86 } 87 88 94 protected void saveWarnings(HttpServletRequest request, ActionMessages warnings) { 95 CoreUtil.saveWarnings(request, warnings); 96 } 97 98 } 99 | Popular Tags |