struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [1/3] struts git commit: Disables params evaluation when creating results by convention
Date Wed, 17 Aug 2016 13:36:28 GMT
Repository: struts
Updated Branches:
  refs/heads/support-2-3 7d8c3598e -> 030ffa335


Disables params evaluation when creating results by convention


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/030ffa33
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/030ffa33
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/030ffa33

Branch: refs/heads/support-2-3
Commit: 030ffa33543f8953306ed0c0dc815c7fb74d7129
Parents: 8e67b91
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Wed Aug 17 15:35:43 2016 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Wed Aug 17 15:36:20 2016 +0200

----------------------------------------------------------------------
 .../convention/ConventionsServiceImpl.java      | 26 ++++++++++++++------
 1 file changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/030ffa33/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
index 56815a6..6e5abda 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
@@ -107,14 +107,26 @@ public class ConventionsServiceImpl implements ConventionsService {
     public Map<String, ResultTypeConfig> getResultTypesByExtension(PackageConfig packageConfig)
{
         Map<String, ResultTypeConfig> results = packageConfig.getAllResultTypeConfigs();
 
+        ResultTypeConfig dispatcher = disableParse(results.get("dispatcher"));
+        ResultTypeConfig velocity = disableParse(results.get("velocity"));
+        ResultTypeConfig freemarker = disableParse(results.get("freemarker"));
+
         Map<String, ResultTypeConfig> resultsByExtension = new HashMap<String, ResultTypeConfig>();
-        resultsByExtension.put("jsp", results.get("dispatcher"));
-        resultsByExtension.put("jspf", results.get("dispatcher"));
-        resultsByExtension.put("jspx", results.get("dispatcher"));
-        resultsByExtension.put("vm", results.get("velocity"));
-        resultsByExtension.put("ftl", results.get("freemarker"));
-        resultsByExtension.put("html", results.get("dispatcher"));
-        resultsByExtension.put("htm", results.get("dispatcher"));
+        resultsByExtension.put("jsp", dispatcher);
+        resultsByExtension.put("jspf", dispatcher);
+        resultsByExtension.put("jspx", dispatcher);
+        resultsByExtension.put("vm", velocity);
+        resultsByExtension.put("ftl", freemarker);
+        resultsByExtension.put("html", dispatcher);
+        resultsByExtension.put("htm", dispatcher);
         return resultsByExtension;
     }
+
+    private ResultTypeConfig disableParse(ResultTypeConfig resultConfig) {
+        if (resultConfig != null) {
+            return new ResultTypeConfig.Builder(resultConfig).addParam("parse", "false").build();
+        }
+        return null;
+    }
+
 }


Mime
View raw message