cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1097074 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Wed, 27 Apr 2011 10:36:10 GMT
Author: sergeyb
Date: Wed Apr 27 10:36:10 2011
New Revision: 1097074

URL: http://svn.apache.org/viewvc?rev=1097074&view=rev
Log:
Merged revisions 1097071 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1097071 | sergeyb | 2011-04-27 11:33:02 +0100 (Wed, 27 Apr 2011) | 1 line
  
  [CXF-3470] Applying a patch on behalf of Carlos Marin
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Apr 27 10:36:10 2011
@@ -1 +1 @@
-/cxf/trunk:1094926,1094992,1095349,1095666
+/cxf/trunk:1094926,1094992,1095349,1095666,1097071

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1097074&r1=1097073&r2=1097074&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Wed Apr 27 10:36:10 2011
@@ -30,6 +30,7 @@ import java.lang.reflect.ParameterizedTy
 import java.lang.reflect.Proxy;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
@@ -200,7 +201,15 @@ public final class InjectionUtils {
         if (!ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
             if (genericType instanceof TypeVariable) {
                 genericType = getType(((TypeVariable)genericType).getBounds(), pos);
+            } else if (genericType instanceof WildcardType) { 
+                WildcardType wildcardType = (WildcardType)genericType;
+                Type[] bounds = wildcardType.getLowerBounds();
+                if (bounds.length == 0) { 
+                    bounds = wildcardType.getUpperBounds();
+                }
+                genericType = getType(bounds, pos);
             }
+
             Class<?> cls = (Class<?>)genericType;
             return cls.isArray() ? cls.getComponentType() : cls;
         }

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1097074&r1=1097073&r2=1097074&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
Wed Apr 27 10:36:10 2011
@@ -526,6 +526,20 @@ public class BookStore {
                                      doGetBook("123"));
     }
     
+    @POST
+    @Path("/books/element/echo")
+    public JAXBElement<Book> echoBookElement(JAXBElement<Book> element) throws
Exception {
+        return element;
+    }
+    
+    @SuppressWarnings("unchecked")
+    @POST
+    @Path("/books/element/echo")
+    public JAXBElement<? super Book> echoBookElementWildcard(JAXBElement<? extends
Book> element) 
+        throws Exception {
+        return (JAXBElement<? super Book>)element;
+    }
+    
     @GET
     @Path("/books/adapter")
     @XmlJavaTypeAdapter(BookInfoAdapter.class)

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1097074&r1=1097073&r2=1097074&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Wed Apr 27 10:36:10 2011
@@ -33,6 +33,8 @@ import java.util.Map;
 
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
 
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpClient;
@@ -868,6 +870,29 @@ public class JAXRSClientServerBookTest e
     }
     
     @Test
+    public void testEchoBookElement() throws Exception {
+        BookStore store = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class);
+        JAXBElement<Book> element = store.echoBookElement(new JAXBElement<Book>(new
QName("", "Book"),
+                                     Book.class,
+                                     new Book("CXF", 123L)));
+        Book book = element.getValue();
+        assertEquals(123L, book.getId());
+        assertEquals("CXF", book.getName());
+    }
+    
+    @Test
+    public void testEchoBookElementWildcard() throws Exception {
+        BookStore store = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class);
+        JAXBElement<? super Book> element = store.echoBookElementWildcard(
+                                        new JAXBElement<Book>(new QName("", "Book"),
+                                        Book.class,
+                                        new Book("CXF", 123L)));
+        Book book = (Book)element.getValue();
+        assertEquals(123L, book.getId());
+        assertEquals("CXF", book.getName());
+    }
+    
+    @Test
     public void testGetBookAdapter() throws Exception {
         getAndCompareAsStrings("http://localhost:" + PORT + "/bookstore/books/adapter",
                                "resources/expected_get_book123.txt",



Mime
View raw message