config.setName(convertParam(orig.getName(), vars)); if (path.length() == 0 || path.charAt(0) != '/') { path = "/" + path; config.setPath(path); config.setType(convertParam(orig.getType(), vars)); config.setRoles(convertParam(orig.getRoles(), vars)); config.setParameter(convertParam(orig.getParameter(), vars)); config.setAttribute(convertParam(orig.getAttribute(), vars)); config.setForward(convertParam(orig.getForward(), vars)); config.setInclude(convertParam(orig.getInclude(), vars)); config.setInput(convertParam(orig.getInput(), vars)); ForwardConfig[] fConfigs = orig.findForwardConfigs(); ForwardConfig cfg; for (int x = 0; x < fConfigs.length; x++) { cfg.setPath(convertParam(fConfigs[x].getPath(), vars)); cfg.setRedirect(fConfigs[x].getRedirect()); config.removeForwardConfig(fConfigs[x]); config.addForwardConfig(cfg); ExceptionConfig[] exConfigs = orig.findExceptionConfigs(); for (int x = 0; x < exConfigs.length; x++) { config.addExceptionConfig(exConfigs[x]); config.freeze();
public void addForwardPath(String siteName, String path, String forwardName, String forwardPath) throws TgwException { ActionConfig actionConfig = getActionConfig(siteName, path); // null-check of actionConfig if (actionConfig == null) { throw new TgwException("action config for " + path + " should not be null"); } ForwardConfig forwardConfig = actionConfig .findForwardConfig(forwardName); if (forwardConfig == null) { forwardConfig = new ActionForward(forwardName, forwardPath, false); actionConfig.addForwardConfig(forwardConfig); } }
/** * Add a new <code>ActionConfig</code> instance to the set associated * with this module. * * @param config The new configuration instance to be added * * @exception java.lang.IllegalStateException if this module configuration * has been frozen */ public void addActionConfig(ActionConfig config) { if (configured) { throw new IllegalStateException("Configuration is frozen"); } config.setModuleConfig(this); actionConfigs.put(config.getPath(), config); actionConfigList.add(config); }
if (getAttribute() == null) { setAttribute(config.getAttribute()); setCancellable(config.getCancellable()); if (getCatalog() == null) { setCatalog(config.getCatalog()); if (getCommand() == null) { setCommand(config.getCommand()); if (getForward() == null) { setForward(config.getForward()); if (getInclude() == null) { setInclude(config.getInclude()); if (getInput() == null) { setInput(config.getInput()); if (getMultipartClass() == null) { setMultipartClass(config.getMultipartClass()); if (getName() == null) { setName(config.getName()); if (getParameter() == null) { setParameter(config.getParameter());
public void removeForwardPath(String siteName, String path, String forwardName, String forwardPath) throws TgwException { ActionConfig actionConfig = getActionConfig(siteName, path); ForwardConfig forwardConfig = actionConfig .findForwardConfig(forwardName); if (actionConfig == null) { throw new TgwException("action config for " + path + " should not be null"); } if (forwardConfig != null) { actionConfig.removeForwardConfig(forwardConfig); } }
config.setName(convertParam(orig.getName(), vars)); config.setPath(path); config.setType(convertParam(orig.getType(), vars)); config.setRoles(convertParam(orig.getRoles(), vars)); config.setParameter(convertParam(orig.getParameter(), vars)); config.setAttribute(convertParam(orig.getAttribute(), vars)); config.setForward(convertParam(orig.getForward(), vars)); config.setInclude(convertParam(orig.getInclude(), vars)); config.setInput(convertParam(orig.getInput(), vars)); config.setCatalog(convertParam(orig.getCatalog(), vars)); config.setCommand(convertParam(orig.getCommand(), vars)); config.setMultipartClass(convertParam(orig.getMultipartClass(), vars)); config.setPrefix(convertParam(orig.getPrefix(), vars)); config.setSuffix(convertParam(orig.getSuffix(), vars)); ForwardConfig[] fConfigs = orig.findForwardConfigs(); ForwardConfig cfg; config.removeForwardConfig(fConfigs[x]); config.addForwardConfig(cfg); replaceProperties(orig.getProperties(), config.getProperties(), vars); ExceptionConfig[] exConfigs = orig.findExceptionConfigs(); config.addExceptionConfig(exConfigs[x]); config.freeze();
actionConfig.setModuleConfig(config); if (!StrutsActionConfig.DEFAULT_PATH.equals(strutsAction.path())) { actionConfig.setPath(strutsAction.path()); } else { actionConfig.setPath(path); actionConfig.setName(strutsAction.name()); } else { actionConfig.setName(this.getName(config, actionClass)); actionConfig.setAttribute(strutsAction.attribute()); actionConfig.setForward(strutsAction.forward()); actionConfig.setInclude(strutsAction.include()); actionConfig.setInput(strutsAction.input()); actionConfig.setParameter(strutsAction.parameter()); actionConfig.setPrefix(strutsAction.prefix()); actionConfig.setRoles(strutsAction.roles()); actionConfig.setScope(strutsAction.scope()); actionConfig.setSuffix(strutsAction.suffix()); actionConfig.setUnknown(strutsAction.unknown().booleanValue());
String ancestor = actionConfig.getExtends(); ForwardConfig[] forwards = actionConfig.findForwardConfigs(); newActionConfig.addForwardConfig(forwards[i]); ExceptionConfig[] exceptions = actionConfig.findExceptionConfigs(); newActionConfig.addExceptionConfig(exceptions[i]);
ForwardConfig[] baseForwards = baseConfig.findForwardConfigs(); ForwardConfig copy = this.findForwardConfig(baseForward.getName()); BeanUtils.copyProperties(copy, baseForward); this.addForwardConfig(copy); copy.setProperties(baseForward.copyProperties()); } else { copy.processExtends(getModuleConfig(), this);
throws ServletException { try { if (!actionConfig.isExtensionProcessed()) { if (log.isDebugEnabled()) { log.debug("Processing extensions for '" + actionConfig.getPath() + "'"); processActionConfigClass(actionConfig, moduleConfig); actionConfig.processExtends(moduleConfig); ForwardConfig[] forwards = actionConfig.findForwardConfigs(); for (int i = 0; i < forwards.length; i++) { ForwardConfig forward = forwards[i]; ExceptionConfig[] exceptions = actionConfig.findExceptionConfigs(); for (int i = 0; i < exceptions.length; i++) { ExceptionConfig exception = exceptions[i]; throw e; } catch (Exception e) { handleGeneralExtensionException("Action", actionConfig.getPath(), e);
String type = actionConfig.getType(); String command = actionConfig.getCommand(); if ((command == null) && (actionConfig.getForward() == null) && (actionConfig.getInclude() == null)) { LOG.error("no type or command for " + actionConfig.getPath()); } else { LOG.trace("no type for " + actionConfig.getPath());
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; }
/** * Freeze the configuration of this action. */ public void freeze() { configured = true; ExceptionConfig[] econfigs = findExceptionConfigs(); for (int i = 0; i < econfigs.length; i++) { econfigs[i].freeze(); } ForwardConfig[] fconfigs = findForwardConfigs(); for (int i = 0; i < fconfigs.length; i++) { fconfigs[i].freeze(); } }
ExceptionConfig[] baseHandlers = baseConfig.findExceptionConfigs(); this.findExceptionConfig(baseHandler.getType()); this.addExceptionConfig(copy); copy.setProperties(baseHandler.copyProperties()); } else { copy.processExtends(getModuleConfig(), this);
if (actionConfig != null) { baseConfig = actionConfig.findForwardConfig(ancestor); actionConfig.removeForwardConfig(forwardConfig); actionConfig.addForwardConfig(newForwardConfig); } else {
FormBeanConfig formBeanConfig = moduleConfig.findFormBeanConfig(mapping.getName()); if (formBeanConfig == null) { JspException e = new JspException(messages.getMessage("formTag.formBean", mapping.getName(), action)); pageContext.setAttribute(Globals.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE); throw e; beanName = mapping.getAttribute(); beanScope = mapping.getScope(); beanType = formBeanConfig.getType();
validationKey = mapping.getPath(); validationKey = mapping.getAttribute(); logger.debug("Validating ActionForm '" + mapping.getName() + "' using key '" + validationKey + "' for mapping '" + mapping.getPath() + "'");
ModuleConfig moduleConfig = actionConfig.getModuleConfig(); String input = actionConfig.getInput(); forwardConfig = actionConfig.findForwardConfig(input);
config.setModuleConfig(this); String path = config.getPath(); if (actionConfigs.containsKey(path)) { log.warn("Overriding ActionConfig of path " + path); String actionId = config.getActionId(); if ((actionId != null) && !actionId.equals("")) { if (actionConfigIds.containsKey(actionId)) { msg.append(actionId); msg.append("] for path["); msg.append(otherConfig.getPath()); msg.append("] with path["); msg.append(path);
public ActionForm getActionForm() { // Is there a mapping associated with this request? ActionMapping mapping = getMapping(); if (mapping == null) return (null); // Is there a form bean associated with this mapping? String attribute = mapping.getAttribute(); if (attribute == null) return (null); // Look up the existing form bean, if any ActionForm instance = null; if ("request".equals(mapping.getScope())) { instance = (ActionForm) this.request.getAttribute(attribute); } else { instance = (ActionForm) this.session.getAttribute(attribute); } return instance; }