You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mr...@apache.org on 2006/12/08 09:36:26 UTC
svn commit: r483883 -
/struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
Author: mrdon
Date: Fri Dec 8 00:36:25 2006
New Revision: 483883
URL: http://svn.apache.org/viewvc?view=rev&rev=483883
Log:
Fixed mis-loading of result types
WW-1538
Modified:
struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
Modified: struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java?view=diff&rev=483883&r1=483882&r2=483883
==============================================================================
--- struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java (original)
+++ struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java Fri Dec 8 00:36:25 2006
@@ -55,7 +55,7 @@
protected String defaultPackageName = "codebehind-default";
protected ServletContext servletContext;
- protected Map<String,ResultTypeConfig> resultsByExtension = new HashMap<String,ResultTypeConfig>();
+ protected Map<String,ResultTypeConfig> resultsByExtension;
protected String templatePathPrefix = "/";
protected Configuration configuration;
protected ObjectFactory objectFactory;
@@ -70,6 +70,13 @@
@Inject
public void setConfiguration(Configuration config) {
this.configuration = config;
+ resultsByExtension = new LinkedHashMap<String,ResultTypeConfig>();
+ PackageConfig parentPackage = configuration.getPackageConfig(defaultPackageName);
+ Map<String,ResultTypeConfig> results = parentPackage.getAllResultTypeConfigs();
+
+ resultsByExtension.put("jsp", results.get("dispatcher"));
+ resultsByExtension.put("vm", results.get("velocity"));
+ resultsByExtension.put("ftl", results.get("freemarker"));
}
@Inject
@@ -82,22 +89,8 @@
this.objectFactory = objectFactory;
}
- protected Map<String,ResultTypeConfig> loadResultTypes(Configuration config) {
- Map<String,ResultTypeConfig> resultTypes = new LinkedHashMap<String,ResultTypeConfig>();
- PackageConfig parentPackage = config.getPackageConfig(defaultPackageName);
- Map<String,ResultTypeConfig> results = parentPackage.getAllResultTypeConfigs();
-
- resultTypes.put("jsp", results.get("dispatcher"));
- resultTypes.put("vm", results.get("velocity"));
- resultTypes.put("ftl", results.get("freemarker"));
- return resultTypes;
- }
-
public ActionConfig handleUnknownAction(String namespace, String actionName)
throws XWorkException {
- if (resultsByExtension == null) {
- resultsByExtension = loadResultTypes(configuration);
- }
String pathPrefix = determinePath(templatePathPrefix, namespace);
ActionConfig actionConfig = null;
for (String ext : resultsByExtension.keySet()) {
@@ -118,9 +111,6 @@
}
protected ActionConfig buildActionConfig(String path, String namespace, String actionName, ResultTypeConfig resultTypeConfig) {
- if (resultsByExtension == null) {
- resultsByExtension = loadResultTypes(configuration);
- }
Map<String,ResultConfig> results = new HashMap<String,ResultConfig>();
HashMap params = new HashMap();
if (resultTypeConfig.getParams() != null) {