struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [1/8] struts git commit: Extends action suffix to support multiple suffixes
Date Tue, 01 Aug 2017 13:51:24 GMT
Repository: struts
Updated Branches:
  refs/heads/master d29caba5e -> 62900ee98


Extends action suffix to support multiple suffixes


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

Branch: refs/heads/master
Commit: cf10f68e766957fdd7f1bf70f25d4cc899a40b87
Parents: cf7bfe6
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Fri Jul 7 10:23:54 2017 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Fri Jul 7 10:23:54 2017 +0200

----------------------------------------------------------------------
 .../convention/PackageBasedActionConfigBuilder.java  | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/cf10f68e/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
b/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
index 25083e2..b244392 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
@@ -75,7 +75,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
     private String packageLocatorsBasePackage;
     private boolean disableActionScanning = false;
     private boolean disablePackageLocatorsScanning = false;
-    private String actionSuffix = "Action";
+    private Set<String> actionSuffix = Collections.singleton("Action");
     private boolean checkImplementsAction = true;
     private boolean mapAllMatches = false;
     private Set<String> loadedFileUrls = new HashSet<>();
@@ -227,7 +227,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
     @Inject(value = "struts.convention.action.suffix", required = false)
     public void setActionSuffix(String actionSuffix) {
         if (StringUtils.isNotBlank(actionSuffix)) {
-            this.actionSuffix = actionSuffix;
+            this.actionSuffix = TextParseUtil.commaDelimitedStringToSet(actionSuffix);
         }
     }
 
@@ -615,7 +615,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
                 // such as com.opensymphony.xwork2.ActionSupport.  We repeat the
                 // package filter here to filter out such results.
                 boolean inPackage = includeClassNameInActionScan(classInfo.getName());
-                boolean nameMatches = classInfo.getName().endsWith(actionSuffix);
+                boolean nameMatches = matchesSuffix(classInfo.getName());
 
                 try {
                     return inPackage && (nameMatches || (checkImplementsAction &&
com.opensymphony.xwork2.Action.class.isAssignableFrom(classInfo.get())));
@@ -624,6 +624,15 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder
{
                     return false;
                 }
             }
+
+            private boolean matchesSuffix(String name) {
+                for (String suffix : actionSuffix) {
+                    if (name.endsWith(suffix)) {
+                        return true;
+                    }
+                }
+                return false;
+            }
         };
     }
 


Mime
View raw message