You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2015/07/15 12:33:29 UTC

cxf git commit: [CXF-6499] Optionally ignore path parameters for the same path method evaluation

Repository: cxf
Updated Branches:
  refs/heads/master 71e16ce66 -> 821072142


[CXF-6499] Optionally ignore path parameters for the same path method evaluation


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

Branch: refs/heads/master
Commit: 821072142a7e54e1226dc2d5e780fbd17cd832f6
Parents: 71e16ce
Author: Sergey Beryozkin <sb...@talend.com>
Authored: Wed Jul 15 13:33:11 2015 +0300
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Wed Jul 15 13:33:11 2015 +0300

----------------------------------------------------------------------
 .../cxf/jaxrs/model/wadl/WadlGenerator.java     | 41 +++++++++++---------
 1 file changed, 23 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/82107214/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
index 01caeb5..ac33eaf 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
@@ -163,6 +163,7 @@ public class WadlGenerator implements ContainerRequestFilter {
     private boolean ignoreOverloadedMethods;
     private boolean checkAbsolutePathSlash;
     private boolean keepRelativeDocLinks;
+    private boolean usePathParamsToCompareOperations = true;
     
     private List<String> externalSchemasCache;
     private List<URI> externalSchemaLinks;
@@ -625,27 +626,31 @@ public class WadlGenerator implements ContainerRequestFilter {
             && ori1.getHttpMethod() == null) {
             return false;
         }
-        int ori1PathParams = 0;
-        int ori1MatrixParams = 0;
-        for (Parameter p : ori1.getParameters()) {
-            if (p.getType() == ParameterType.PATH) {
-                ori1PathParams++;
-            } else if (p.getType() == ParameterType.MATRIX) {
-                ori1MatrixParams++;
+        if (usePathParamsToCompareOperations) {
+            int ori1PathParams = 0;
+            int ori1MatrixParams = 0;
+            for (Parameter p : ori1.getParameters()) {
+                if (p.getType() == ParameterType.PATH) {
+                    ori1PathParams++;
+                } else if (p.getType() == ParameterType.MATRIX) {
+                    ori1MatrixParams++;
+                }
             }
-        }
-
-        int ori2PathParams = 0;
-        int ori2MatrixParams = 0;
-        for (Parameter p : ori2.getParameters()) {
-            if (p.getType() == ParameterType.PATH) {
-                ori2PathParams++;
-            } else if (p.getType() == ParameterType.MATRIX) {
-                ori2MatrixParams++;
+    
+            int ori2PathParams = 0;
+            int ori2MatrixParams = 0;
+            for (Parameter p : ori2.getParameters()) {
+                if (p.getType() == ParameterType.PATH) {
+                    ori2PathParams++;
+                } else if (p.getType() == ParameterType.MATRIX) {
+                    ori2MatrixParams++;
+                }
             }
+    
+            return ori1PathParams == ori2PathParams && ori1MatrixParams == ori2MatrixParams;
+        } else {
+            return true;
         }
-
-        return ori1PathParams == ori2PathParams && ori1MatrixParams == ori2MatrixParams;
     }
 
     private boolean openResource(String path) {