cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Warning when JAX-RS methods are ambiguous, with thanks to Romain
Date Wed, 01 Jul 2015 17:09:48 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 47770a386 -> 0e063bc89


Warning when JAX-RS methods are ambiguous, with thanks to Romain


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

Branch: refs/heads/2.7.x-fixes
Commit: 0e063bc895d14bd3393b36160d530714b75c9318
Parents: 47770a3
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Jul 1 17:51:50 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Jul 1 18:09:24 2015 +0100

----------------------------------------------------------------------
 .../jaxrs/model/OperationResourceInfoComparator.java    | 12 +++++++++++-
 .../main/java/org/apache/cxf/jaxrs/utils/FormUtils.java |  4 +++-
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0e063bc8/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java
index 74073eb..acd51a8 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfoComparator.java
@@ -22,17 +22,19 @@ package org.apache.cxf.jaxrs.model;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.logging.Logger;
 
 import javax.ws.rs.HttpMethod;
 import javax.ws.rs.core.MediaType;
 
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.jaxrs.ext.ResourceComparator;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 
 public class OperationResourceInfoComparator implements Comparator<OperationResourceInfo>
{
-    
+    private static final Logger LOG = LogUtils.getL7dLogger(JAXRSUtils.class);
     private String httpMethod;
     private boolean getMethod;
     private Message message;
@@ -103,6 +105,14 @@ public class OperationResourceInfoComparator implements Comparator<OperationReso
                                                               acceptTypes);
         }
         
+        if (result == 0) {
+            String m1Name = 
+                e1.getClassResourceInfo().getServiceClass().getName() + "#" + e1.getMethodToInvoke().getName();
+            String m2Name = 
+                e2.getClassResourceInfo().getServiceClass().getName() + "#" + e2.getMethodToInvoke().getName();
+            LOG.warning("Both " + m1Name + " and " + m2Name + " are equal candidates for
handling the current request"
+                        + " which can lead to unpredictable results");
+        }
         return result;
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/0e063bc8/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
index dd4bfd7..d405544 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
@@ -47,6 +47,7 @@ import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
 import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.jaxrs.provider.FormEncodingProvider;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 
 public final class FormUtils {
@@ -143,7 +144,8 @@ public final class FormUtils {
                                              javax.servlet.http.HttpServletRequest request)
{
         if (!StringUtils.isEmpty(postBody)) {
             populateMapFromString(params, m, postBody, enc, decode);
-        } else if (request != null) {
+        } else if (request != null 
+            && MessageUtils.getContextualBoolean(m, "set.form.parameters.from.http.parameters",
true)) {
             for (Enumeration<String> en = request.getParameterNames(); en.hasMoreElements();)
{
                 String paramName = en.nextElement();
                 String[] values = request.getParameterValues(paramName);


Mime
View raw message