cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1515823 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Tue, 20 Aug 2013 13:38:29 GMT
Author: sergeyb
Date: Tue Aug 20 13:38:29 2013
New Revision: 1515823

URL: http://svn.apache.org/r1515823
Log:
[CXF-5204] Taking care of TypeVars wrapped in GenericEntity too

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractGenericBookStoreSpring.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1515823&r1=1515822&r2=1515823&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Tue Aug 20 13:38:29 2013
@@ -1269,7 +1269,7 @@ public final class InjectionUtils {
         }
         Type type = null;
         if (GenericEntity.class.isAssignableFrom(targetObject.getClass())) {
-            type = ((GenericEntity<?>)targetObject).getType();
+            type = processGenericTypeIfNeeded(serviceCls, targetType, ((GenericEntity<?>)targetObject).getType());
         } else if (invoked == null 
                    || !invoked.getReturnType().isAssignableFrom(targetType)) {
             // when a method has been invoked it is still possible that either an ExceptionMapper

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractGenericBookStoreSpring.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractGenericBookStoreSpring.java?rev=1515823&r1=1515822&r2=1515823&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractGenericBookStoreSpring.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractGenericBookStoreSpring.java
Tue Aug 20 13:38:29 2013
@@ -23,10 +23,14 @@ package org.apache.cxf.systest.jaxrs;
 import java.util.List;
 
 import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.GenericEntity;
+
+import edu.emory.mathcs.backport.java.util.Collections;
 
 @Path("/")
 @Consumes({"application/json", "application/xml" })
@@ -50,7 +54,15 @@ public abstract class AbstractGenericBoo
         }
         throw new WebApplicationException(400);
     }
-        
+     
+    @SuppressWarnings("unchecked")
+    @GET
+    @Path("/books/superbooks2")
+    public GenericEntity<List<T>> getSuperBookCollectionGenericEntity() {
+        return new GenericEntity<List<T>>(Collections.singletonList(new SuperBook("Super",
124L, true))) {
+        };
+    }
+    
 }
 
 

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java?rev=1515823&r1=1515822&r2=1515823&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
Tue Aug 20 13:38:29 2013
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.MediaType;
 
 import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@@ -209,6 +210,23 @@ public class JAXRSClientServerResourceJa
     }
     
     @Test
+    public void testGetGenericSuperBookCollectionWebClient() throws Exception {
+        
+        String endpointAddress = 
+            "http://localhost:" + PORT + "/webapp/genericstore/books/superbooks2";
+        WebClient wc = WebClient.create(endpointAddress, 
+                                        Collections.singletonList(new JacksonJsonProvider()));
+        WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(100000000L);
+        wc.accept(MediaType.APPLICATION_JSON);
+        List<SuperBook> books = wc.get(new GenericType<List<SuperBook>>()
{
+        });
+        
+        SuperBook book = books.iterator().next();
+        assertEquals(124L, book.getId());
+        assertTrue(book.isSuperBook());
+    }
+    
+    @Test
     public void testEchoGenericSuperBookCollectionWebClientXml() throws Exception {
         
         String endpointAddress = 



Mime
View raw message