1 19 20 package com.sslexplorer.policyframework.actions; 21 22 import javax.servlet.http.HttpServletRequest ; 23 import javax.servlet.http.HttpServletResponse ; 24 25 import org.apache.struts.action.ActionForm; 26 import org.apache.struts.action.ActionForward; 27 import org.apache.struts.action.ActionMapping; 28 29 import com.sslexplorer.agent.DefaultAgentManager; 30 import com.sslexplorer.boot.Util; 31 import com.sslexplorer.core.CoreUtil; 32 import com.sslexplorer.core.actions.AuthenticatedAction; 33 import com.sslexplorer.policyframework.LaunchSession; 34 import com.sslexplorer.policyframework.LaunchSessionFactory; 35 import com.sslexplorer.policyframework.Policy; 36 import com.sslexplorer.policyframework.Resource; 37 import com.sslexplorer.policyframework.ResourceType; 38 import com.sslexplorer.security.Constants; 39 import com.sslexplorer.security.SessionInfo; 40 41 49 public abstract class AbstractRedirectLaunchAction extends AbstractLaunchAction { 50 51 58 public AbstractRedirectLaunchAction(ResourceType resourceType, int navigationContext) { 59 super(resourceType, navigationContext); 60 } 61 62 protected ActionForward launch(ActionMapping mapping, LaunchSession launchSession, HttpServletRequest request, String returnTo) 63 throws Exception { 64 if(isDirectLink(launchSession)) { 65 String link = doPrepareLink(launchSession, returnTo); 66 return new ActionForward(link, true); 67 } 68 else { 69 request.setAttribute(Constants.REQ_ATTR_FORWARD_TO, returnTo); 70 request.setAttribute(Constants.REQ_ATTR_FOLDER, ""); 71 request.setAttribute(Constants.REQ_ATTR_TARGET, ""); 72 request.setAttribute(Constants.REQ_ATTR_EXEC_ON_LOAD, doPrepareLink(launchSession, returnTo)); 73 return mapping.findForward("redirect"); 74 } 75 76 } 77 78 protected abstract String doPrepareLink(LaunchSession launchSession, String returnTo); 79 80 protected abstract boolean isDirectLink(LaunchSession launchSession); 81 } 82 | Popular Tags |