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:03:46 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes c4515f132 -> f320e230d


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/f320e230
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f320e230
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f320e230

Branch: refs/heads/3.0.x-fixes
Commit: f320e230d35d9a90511f3b347ea241a1b659afc0
Parents: c4515f1
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:03:25 2015 +0100

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


http://git-wip-us.apache.org/repos/asf/cxf/blob/f320e230/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 5def5a2..a78ca87 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,10 +22,12 @@ 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.DefaultMethod;
 import org.apache.cxf.jaxrs.ext.ResourceComparator;
@@ -33,7 +35,7 @@ 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;
@@ -117,7 +119,14 @@ public class OperationResourceInfoComparator implements Comparator<OperationReso
                 result = -1;
             } 
         }
-        
+        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/f320e230/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 b0eb85f..afee3bc 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 {
@@ -154,7 +155,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