/** * Create a Struts 1.x ModuleConfig based on an XWork package configuration. * * @param packageName the name of the XWork package configuration to wrap. This becomes the module prefix for the * newly-created ModuleConfig. * @return a wrapper Struts 1.x ModuleConfig. */ public ModuleConfig createModuleConfig(String packageName) { assert packageName != null; return new WrapperModuleConfig(this, configuration.getPackageConfig(packageName)); }
for (String parentPackageName : ConfigurationUtil.buildParentListFromString(parent)) { if (configuration.getPackageConfigNames().contains(parentPackageName)) { parents.add(configuration.getPackageConfig(parentPackageName)); } else if (declaredPackages.containsKey(parentPackageName)) { if (configuration.getPackageConfig(parentPackageName) == null) { addPackage(declaredPackages.get(parentPackageName)); parents.add(configuration.getPackageConfig(parentPackageName)); } else { throw new ConfigurationException("Parent package is not defined: " + parentPackageName);
/** * Get the {@link PackageConfig} elements with the specified names. * @param configuration Configuration from which to find the package elements * @param parent Comma separated list of parent package names * @return The package elements that correspond to the names in the {@code parent} parameter. */ public static List<PackageConfig> buildParentsFromString(Configuration configuration, String parent) { List<String> parentPackageNames = buildParentListFromString(parent); List<PackageConfig> parentPackageConfigs = new ArrayList<PackageConfig>(); for (String parentPackageName : parentPackageNames) { PackageConfig parentPackageContext = configuration.getPackageConfig(parentPackageName); if (parentPackageContext != null) { parentPackageConfigs.add(parentPackageContext); } } return parentPackageConfigs; }
public List<PackageConfig> getPackages() { List<PackageConfig> pkgs = new ArrayList<PackageConfig>(); Bundle bundle = getBundle(); if (bundle.getState() == Bundle.ACTIVE) { for (String name : bundleAccessor.getPackagesByBundle(bundle)) { PackageConfig packageConfig = configuration.getPackageConfig(name); if (packageConfig != null) pkgs.add(packageConfig); } } return pkgs; }
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(); }
LOG.trace("Found action config"); PackageConfig packageConfig = configuration.getPackageConfig(actionConfig.getPackageName()); if (redirectNamespace.equals(packageConfig.getNamespace())) { LOG.trace("Action is not a default - redirecting");
PackageConfig parentPkg = configuration.getPackageConfig(parentName); if (parentPkg == null) { throw new ConfigurationException("Unable to locate parent package [" + parentName + "] for [" + actionClass + "]");
public Result handleUnknownResult(ActionContext actionContext, String actionName, ActionConfig actionConfig, String resultCode) throws XWorkException { PackageConfig pkg = configuration.getPackageConfig(actionConfig.getPackageName()); String ns = pkg.getNamespace(); String pathPrefix = determinePath(actionConfig, ns);
PackageConfig existingPkg = configuration.getPackageConfig(pkgCfg.getName()); if (existingPkg != null) {
PackageConfig packageConfig = configuration.getPackageConfig(packageName); if (packageConfig != null) { if (LOG.isDebugEnabled()) {
this.nameSeparator = nameSeparator; this.parentPackage = configuration.getPackageConfig(defaultParentPackageName); if (parentPackage == null) { throw new ConfigurationException("Unknown default parent package [" + defaultParentPackageName + "]");