Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C9E021806A for ; Wed, 15 Jul 2015 10:34:33 +0000 (UTC) Received: (qmail 52959 invoked by uid 500); 15 Jul 2015 10:34:33 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 52896 invoked by uid 500); 15 Jul 2015 10:34:33 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 52887 invoked by uid 99); 15 Jul 2015 10:34:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jul 2015 10:34:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5DCB5E0F7B; Wed, 15 Jul 2015 10:34:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: <69a68443e76a4cc5a4059af33cd4186a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: [CXF-6499] Optionally ignore path parameters for the same path method evaluation Date: Wed, 15 Jul 2015 10:34:33 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 90de43b2c -> a5f83ebe4 [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/a5f83ebe Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a5f83ebe Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a5f83ebe Branch: refs/heads/3.0.x-fixes Commit: a5f83ebe4ef4f202d2f18baea99e8fa9737a8fe9 Parents: 90de43b Author: Sergey Beryozkin Authored: Wed Jul 15 13:33:11 2015 +0300 Committer: Sergey Beryozkin Committed: Wed Jul 15 13:34:14 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/a5f83ebe/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 24de86b..90b6fac 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 @@ -164,6 +164,7 @@ public class WadlGenerator implements ContainerRequestFilter { private boolean ignoreOverloadedMethods; private boolean checkAbsolutePathSlash; private boolean keepRelativeDocLinks; + private boolean usePathParamsToCompareOperations = true; private List externalSchemasCache; private List externalSchemaLinks; @@ -626,27 +627,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) {