private void setDefaultResults(Map<String, ResultConfig> results, PackageConfig packageContext) { String defaultResult = packageContext.getFullDefaultResultType(); for (Map.Entry<String, ResultConfig> entry : results.entrySet()) { if (entry.getValue() == null) { ResultTypeConfig resultTypeConfig = packageContext.getAllResultTypeConfigs().get(defaultResult); entry.setValue(new ResultConfig.Builder(null, resultTypeConfig.getClassName()).build()); } } }
ResultConfig resultConfig = new ResultConfig.Builder(resultName, resultClass) .addParams(params) .location(DomHelper.getLocationObject(element))
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(); }
ResultConfig result = orig.getResults().get(name); name = convertParam(name, vars); ResultConfig r = new ResultConfig.Builder(name, convertParam(result.getClassName(), vars)) .addParams(replaceParameters(result.getParams(), vars)) .build();
return new ResultConfig.Builder(info.name, resultTypeConfig.getClassName()).addParams(params).build();
protected Result buildResult(String path, String resultCode, ResultTypeConfig config, ActionContext invocationContext) { String resultClass = config.getClassName(); Map<String, String> params = new LinkedHashMap<>(); if (config.getParams() != null) { params.putAll(config.getParams()); } params.put(config.getDefaultResultParam(), path); ResultConfig resultConfig = new ResultConfig.Builder(resultCode, resultClass).addParams(params).build(); try { return objectFactory.buildResult(resultConfig, invocationContext.getContextMap()); } catch (Exception e) { throw new XWorkException("Unable to build convention result", e, resultConfig); } }