/** * <p>Find and return the <code>ForwardConfig</code> instance defining * how forwarding to the specified logical name should be handled. This is * performed by checking local and then global configurations for the * specified forwarding configuration. If no forwarding configuration * can be found, return <code>null</code>.</p> * * @param name Logical name of the forwarding instance to be returned */ public ActionForward findForward(String name) { ForwardConfig config = findForwardConfig(name); if (config == null) { config = getModuleConfig().findForwardConfig(name); } if (config == null) { if (log.isWarnEnabled()) { log.warn("Unable to find '" + name + "' forward."); } } return ((ActionForward) config); }
config = getModuleConfig().findExceptionConfig(name);
config = getModuleConfig().findExceptionConfig(name); if (config != null) { return (config);
protected synchronized Action getAction(ActionContext context, String type, ActionConfig actionConfig) throws Exception { ModuleConfig moduleConfig = actionConfig.getModuleConfig(); String actionsKey = Constants.ACTIONS_KEY + moduleConfig.getPrefix(); Map actions = (Map) context.getApplicationScope().get(actionsKey); if (actions == null) { actions = new HashMap(); context.getApplicationScope().put(actionsKey, actions); } Action action = null; synchronized (actions) { action = (Action) actions.get(type); if (action == null) { action = createAction(context, type); actions.put(type, action); } } if (action.getServlet() == null) { ServletActionContext saContext = (ServletActionContext) context; ActionServlet actionServlet = saContext.getActionServlet(); action.setServlet(actionServlet); } return (action); }
/** * <p>Initialize all bean properties to their initial values, as specified * in the {@link FormPropertyConfig} elements associated with the * definition of this <code>DynaActionForm</code>.</p> * * @param mapping The mapping used to select this instance */ public void initialize(ActionMapping mapping) { String name = mapping.getName(); if (name == null) { return; } FormBeanConfig config = mapping.getModuleConfig().findFormBeanConfig(name); if (config == null) { return; } initialize(config); }
/** * <p>Select and cache the <code>ActionForward</code> for this * <code>ActionConfig</code> if specified.</p> * * @param actionCtx The <code>Context</code> for the current request * @return <code>false</code> so that processing continues * @throws Exception if thrown by the Action class */ public boolean execute(ActionContext actionCtx) throws Exception { // Skip processing if the current request is not valid Boolean valid = actionCtx.getFormValid(); if ((valid == null) || !valid.booleanValue()) { return (false); } // Acquire configuration objects that we need ActionConfig actionConfig = actionCtx.getActionConfig(); ModuleConfig moduleConfig = actionConfig.getModuleConfig(); ForwardConfig forwardConfig = null; String forward = actionConfig.getForward(); if (forward != null) { forwardConfig = forward(actionCtx, moduleConfig, forward); if (LOG.isDebugEnabled()) { LOG.debug("Forwarding to " + forwardConfig); } actionCtx.setForwardConfig(forwardConfig); } return (false); }
ModuleConfig moduleConfig = actionConfig.getModuleConfig();
/** * <p>Create (if necessary) and return an {@link ActionForward} that * corresponds to the <code>input</code> property of this Action.</p> * * @since Struts 1.1 */ public ActionForward getInputForward() { if (getModuleConfig().getControllerConfig().getInputForward()) { return (findForward(getInput())); } else { return (new ActionForward(getInput())); } }
public boolean execute(ActionContext actionContext) throws Exception { ActionConfig actionConfig = actionContext.getActionConfig(); String name = actionConfig.getName(); if (name == null) { return false; } FormBeanConfig formBeanConfig = actionConfig.getModuleConfig().findFormBeanConfig(name); if (formBeanConfig == null) { return false; } Map scope = actionContext.getScope(actionConfig.getScope()); Object instance = scope.get(actionConfig.getAttribute()); if (instance == null) { return false; } if (instance instanceof ActionForm) { return false; } BeanValidatorForm form = BeanValidatorFormUtil.toBeanValidatorForm(null, instance); scope.put(actionConfig.getAttribute(), form); return false; }
} else { copy.processExtends(getModuleConfig(), this);
} else { copy.processExtends(getModuleConfig(), this);
actionConfig.getModuleConfig().findFormBeanConfig(name); + actionConfig.getModuleConfig().getPrefix() + " under name " + name); actionCtx.setActionForm(null);