cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1568083 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Thu, 13 Feb 2014 22:49:57 GMT
Author: sergeyb
Date: Thu Feb 13 22:49:56 2014
New Revision: 1568083

URL: http://svn.apache.org/r1568083
Log:
[CXF-5562] Relaxing the checks when injecting via setters, no need to have a name match

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/BeanResourceInfo.java
    cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/BeanResourceInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/BeanResourceInfo.java?rev=1568083&r1=1568082&r2=1568083&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/BeanResourceInfo.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/BeanResourceInfo.java
Thu Feb 13 22:49:56 2014
@@ -82,7 +82,7 @@ public abstract class BeanResourceInfo e
             }
             for (Annotation a : m.getAnnotations()) {
                 if (AnnotationUtils.isParamAnnotationClass(a.annotationType())) {
-                    checkParamMethod(m, AnnotationUtils.getAnnotationValue(a));
+                    addParamMethod(m);
                     break;
                 }
             }
@@ -110,10 +110,4 @@ public abstract class BeanResourceInfo e
         return paramFields == null ? Collections.<Field>emptyList() 
                                     : Collections.unmodifiableList(paramFields);
     }
-    
-    private void checkParamMethod(Method m, String value) {
-        if (m.getName().equalsIgnoreCase("set" + value)) {
-            addParamMethod(m);
-        }
-    }
 }

Modified: cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java?rev=1568083&r1=1568082&r2=1568083&view=diff
==============================================================================
--- cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
(original)
+++ cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
Thu Feb 13 22:49:56 2014
@@ -469,12 +469,14 @@ public class ClientProxyImpl extends Abs
         Map<String, Object> values = new HashMap<String, Object>();
         
         for (Method m : bean.getClass().getMethods()) {
-            if (m.getAnnotation(annClass) != null) {
+            Annotation annotation = m.getAnnotation(annClass);
+            if (annotation != null) {
                 try {
                     String propertyName = m.getName().substring(3);
                     Method getter = bean.getClass().getMethod("get" + propertyName, new Class[]{});
                     Object value = getter.invoke(bean, new Object[]{});
-                    values.put(propertyName.toLowerCase(), value);
+                    String annotationValue = AnnotationUtils.getAnnotationValue(annotation);
+                    values.put(annotationValue, value);
                 } catch (Throwable t) {
                     // ignore
                 }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1568083&r1=1568082&r2=1568083&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Thu
Feb 13 22:49:56 2014
@@ -1580,7 +1580,7 @@ public class BookStore {
             return id2;
         }
 
-        @QueryParam("id2")
+        @QueryParam("id_2")
         public void setId2(long id2) {
             this.id2 = id2;
         }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1568083&r1=1568082&r2=1568083&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Thu Feb 13 22:49:56 2014
@@ -283,7 +283,7 @@ public class JAXRSClientServerBookTest e
     private void doTestUseParamBeanWebClient(String address) {
         WebClient wc = WebClient.create(address);
         wc.path("100");
-        wc.query("id2", "20");
+        wc.query("id_2", "20");
         wc.query("id3", "3");
         Book book = wc.get(Book.class);
         assertEquals(123L, book.getId());



Mime
View raw message