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.Action; 9 import org.apache.struts.action.ActionForm; 10 import org.apache.struts.action.ActionForward; 11 import org.apache.struts.action.ActionMapping; 12 import org.apache.struts.action.ActionMessages; 13 14 import com.sslexplorer.boot.ContextHolder; 15 import com.sslexplorer.core.CoreUtil; 16 import com.sslexplorer.security.SessionInfo; 17 18 26 public abstract class DefaultAction extends Action implements CoreAction { 27 28 36 public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 37 throws Exception { 38 ActionForward fwd = checkIntercept(mapping, request, response); 39 if (fwd == null) { 40 if (isInstallMode()) { 41 if ((getNavigationContext(mapping, form, request, response) & SessionInfo.SETUP_CONSOLE_CONTEXT) == 0) { 42 return mapping.findForward("setup"); 43 } 44 } 45 fwd = super.execute(mapping, form, request, response); 46 if(fwd == null) { 47 53 fwd = mapping.findForward("display"); 54 } 55 } 56 return fwd; 57 } 58 59 64 public boolean isInstallMode() { 65 return ContextHolder.getContext().isSetupMode(); 66 } 67 68 78 public ActionForward checkIntercept(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response) 79 throws Exception { 80 return CoreUtil.checkIntercept(this, mapping, request, response); 81 } 82 83 84 90 protected void addWarnings(HttpServletRequest request, ActionMessages warnings) { 91 CoreUtil.addWarnings(request, warnings); 92 } 93 94 100 protected ActionMessages getWarnings(HttpServletRequest request) { 101 return CoreUtil.getWarnings(request); 102 } 103 104 110 protected void saveWarnings(HttpServletRequest request, ActionMessages warnings) { 111 CoreUtil.saveWarnings(request, warnings); 112 } 113 } | Popular Tags |