return new ActionConfig.Builder(baseConfig) .addParams(params) .addResultConfigs(results) .defaultClassName(packageContext.getDefaultClassRef()) // fill in default if non class has been provided .interceptors(interceptors) .addExceptionMappings(packageContext.getAllExceptionMappingConfigs()) .build();
protected ActionConfig buildActionConfig(String path, ResultTypeConfig resultTypeConfig) { Map<String, ResultConfig> results = new HashMap<>(); HashMap<String, String> params = new HashMap<>(); if (resultTypeConfig.getParams() != null) { params.putAll(resultTypeConfig.getParams()); } params.put(resultTypeConfig.getDefaultResultParam(), path); PackageConfig pkg = configuration.getPackageConfig(defaultParentPackageName); List<InterceptorMapping> interceptors = InterceptorBuilder.constructInterceptorReference(pkg, pkg.getFullDefaultInterceptorRef(), Collections.<String, String>emptyMap(), null, objectFactory); ResultConfig config = new ResultConfig.Builder(Action.SUCCESS, resultTypeConfig.getClassName()). addParams(params).build(); results.put(Action.SUCCESS, config); return new ActionConfig.Builder(defaultParentPackageName, "execute", ActionSupport.class.getName()). addInterceptors(interceptors). addResultConfigs(results). addAllowedMethod(pkg.getGlobalAllowedMethods()). build(); }
ActionConfig.Builder actionConfig = new ActionConfig.Builder(pkgCfg.getName(), actionName, className); actionConfig.methodName(actionMethod); actionConfig.addAllowedMethod(actionMethod); actionConfig.addAllowedMethod(allowedMethods); actionConfig.addAllowedMethod(pkgCfg.getGlobalAllowedMethods()); } else { actionConfig.addAllowedMethod(ActionConfig.WILDCARD); actionConfig.addInterceptors(interceptors); actionConfig.addResultConfigs(results); actionConfig.addParams(StringTools.createParameterMap(annotation.params())); actionConfig.addExceptionMappings(buildExceptionMappings(annotation.exceptionMappings(), actionName)); actionConfig.addExceptionMappings(buildExceptionMappings(exceptionMappings.value(), actionName)); pkgCfg.addActionConfig(actionName, actionConfig.build());
ActionConfig actionConfig = new ActionConfig.Builder(packageContext.getName(), name, className) .methodName(methodName) .addResultConfigs(results) .addInterceptors(interceptorList) .addExceptionMappings(exceptionMappings) .addParams(XmlHelper.getParams(actionElement)) .addAllowedMethod(allowedMethods) .location(location) .build(); packageContext.addActionConfig(name, actionConfig);
return new ActionConfig.Builder(pkgName, orig.getName(), className) .methodName(methodName) .addParams(params) .addResultConfigs(results) .addInterceptors(orig.getInterceptors()) .addExceptionMappings(exs) .location(orig.getLocation()) .build();
/** * Gets the configuration information for an action name, or returns null if the * name is not recognized. * * @param name the name of the action * @param namespace the namespace for the action or null for the empty namespace, "" * @return the configuration information for action requested */ public ActionConfig getActionConfig(String namespace, String name) { ActionConfig config = findActionConfigInNamespace(namespace, name); // try wildcarded namespaces if (config == null) { NamespaceMatch match = namespaceMatcher.match(namespace); if (match != null) { config = findActionConfigInNamespace(match.getPattern(), name); // If config found, place all the matches found in the namespace processing in the action's parameters if (config != null) { config = new ActionConfig.Builder(config) .addParams(match.getVariables()) .build(); } } } // fail over to empty namespace if ((config == null) && (namespace != null) && (!"".equals(namespace.trim()))) { config = findActionConfigInNamespace("", name); } return config; }
public Builder(ActionConfig toClone) { target = new ActionConfig(toClone); addAllowedMethod(toClone.getAllowedMethods()); }
@Override public ActionConfig handleUnknownAction(String namespace, String actionName) { return new ActionConfig.Builder(namespace, actionName, Object.class.getName()).build(); }