/** * Add Struts ForwardConfigs (from XWork ResultConfigs). */ private void initActionForwards() { if (forwards == null) { forwards = new HashMap(); Map results = delegate.getResults(); for (Iterator i = results.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); ActionForward wrapper = strutsFactory.createActionForward((ResultConfig) entry.getValue()); forwards.put(wrapper.getName(), wrapper); } } }
/** * <p>Construct a new instance based on the values of another * ActionForward.</p> * * @param copyMe An ActionForward instance to copy * @since Struts 1.2.1 */ public ActionForward(ActionForward copyMe) { this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(), copyMe.getModule()); } }
public MockActionForward(ActionForward copyMe) { setName(copyMe.getName()); setPath(copyMe.getPath()); setRedirect(copyMe.getRedirect()); try { Method getContextRelativeMethod = copyMe.getClass().getMethod("getContextRelative", null); Boolean value = (Boolean)getContextRelativeMethod.invoke(copyMe, null); if(null != value) { setContextRelative(value.booleanValue()); } } catch(Exception exc) { //Struts 1.3 does not define the method "getContextRelative" //this hack is necessary to avoid different versions for Struts 1.2 and 1.3 } }
public MockActionForward(ActionForward copyMe) { setName(copyMe.getName()); setPath(copyMe.getPath()); setRedirect(copyMe.getRedirect()); try { Method getContextRelativeMethod = copyMe.getClass().getMethod("getContextRelative", null); Boolean value = (Boolean)getContextRelativeMethod.invoke(copyMe, null); if(null != value) { setContextRelative(value.booleanValue()); } } catch(Exception exc) { //Struts 1.3 does not define the method "getContextRelative" //this hack is necessary to avoid different versions for Struts 1.2 and 1.3 } }
public MockActionForward(ActionForward copyMe) { setName(copyMe.getName()); setPath(copyMe.getPath()); setRedirect(copyMe.getRedirect()); try { Method getContextRelativeMethod = copyMe.getClass().getMethod("getContextRelative", null); Boolean value = (Boolean)getContextRelativeMethod.invoke(copyMe, null); if(null != value) { setContextRelative(value); } } catch(Exception exc) { //Struts 1.3 does not define the method "getContextRelative" //this hack is necessary to avoid different versions for Struts 1.2 and 1.3 } }
public void processFormActionAndForward(final HttpServletRequest request, final HttpServletResponse response, final ActionMapping mapping) throws ServletException, IOException { ActionForm form = processActionForm(request, response, mapping); processPopulate(request, response, form, mapping); // need to make sure that we don't check CSRF until after the form is populated so that Struts will parse the // multipart parameters into the request if it's a multipart request if (!getCsrfService().validateCsrfIfNecessary(request, response)) { return; } // Create or acquire the Action instance to process this request Action action = processActionCreate(request, response, mapping); if (action != null) { // Call the Action instance itself ActionForward forward = processActionPerform(request, response, action, form, mapping); if (forward != null) { if (forward.getRedirect() && forward.getName()!= null && forward.getName().equals(KRADConstants.KRAD_INITIATED_DOCUMENT_VIEW_NAME)) { LOG.info("Attempt to open a document with a status of \"Initiated\" detected"); return; } // ProcessDefinition the returned ActionForward instance processForwardConfig(request, response, forward); } } }
public ActionForward docHandler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionForward af = super.docHandler(mapping, form, request, response); if (af.getName().equals(KRADConstants.KRAD_INITIATED_DOCUMENT_VIEW_NAME))
/** * Find an action forward for given application view. If no suitable forward is found in the action mapping using * the view name as a key, this method will create a new action forward using the view name. * @param forward the application view to find a forward for * @param mapping the action mapping to use * @return the action forward, never null */ protected ActionForward findForward(ApplicationView forward, ActionMapping mapping) { // note that this method is always creating a new ActionForward to make // sure that the redirect flag is false -- redirect is controlled by SWF // itself, not Struts ActionForward actionForward = mapping.findForward(forward.getViewName()); if (actionForward != null) { // the 1.2.1 copy constructor would ideally be better to // use, but it is not Struts 1.1 compatible actionForward = new ActionForward(actionForward.getName(), actionForward.getPath(), false); } else { actionForward = new ActionForward(forward.getViewName(), false); } return actionForward; } }