You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2013/08/20 14:32:24 UTC
svn commit: r1515798 - in /cxf/branches/2.7.x-fixes: ./
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/
systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/
Author: sergeyb
Date: Tue Aug 20 12:32:24 2013
New Revision: 1515798
URL: http://svn.apache.org/r1515798
Log:
Merged revisions 1515796 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1515796 | sergeyb | 2013-08-20 15:21:40 +0300 (Tue, 20 Aug 2013) | 1 line
[CXF-5204] Some more work to do with handling TypeVariable
........
Added:
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractBookStoreSpring.java
- copied unchanged from r1515796, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractBookStoreSpring.java
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpring2.java
- copied unchanged from r1515796, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpring2.java
Modified:
cxf/branches/2.7.x-fixes/ (props changed)
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1515796
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1515798&r1=1515797&r2=1515798&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Tue Aug 20 12:32:24 2013
@@ -131,15 +131,18 @@ public final class InjectionUtils {
}
Type genericSubtype = serviceClass.getGenericSuperclass();
- if (genericSubtype == Object.class) {
+ if (!(genericSubtype instanceof ParameterizedType)) {
Type[] genInterfaces = serviceClass.getGenericInterfaces();
for (Type t : genInterfaces) {
genericSubtype = t;
break;
}
}
- Type result = genericSubtype != Object.class ? InjectionUtils.getActualType(genericSubtype, pos)
- : genericSubtype;
+ if (!(genericSubtype instanceof ParameterizedType)) {
+ genericSubtype = null;
+ }
+ Type result = InjectionUtils.getActualType(genericSubtype, pos);
+
if (result == null || result == Object.class) {
Type[] bounds = var.getBounds();
int boundPos = bounds.length > pos ? pos : 0;
@@ -210,6 +213,9 @@ public final class InjectionUtils {
if (genericType == null) {
return null;
}
+ if (genericType == Object.class) {
+ return (Class<?>)genericType;
+ }
if (!ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
if (genericType instanceof TypeVariable) {
genericType = getType(((TypeVariable<?>)genericType).getBounds(), pos);
Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java?rev=1515798&r1=1515797&r2=1515798&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java Tue Aug 20 12:32:24 2013
@@ -133,12 +133,39 @@ public class JAXRSClientServerResourceJa
"http://localhost:" + PORT + "/webapp/genericstore";
GenericBookStoreSpring proxy = JAXRSClientFactory.create(endpointAddress,
GenericBookStoreSpring.class, Collections.singletonList(new JacksonJsonProvider()));
+ WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(1000000000L);
SuperBook book = proxy.echoSuperBookJson(new SuperBook("Super", 124L, true));
assertEquals(124L, book.getId());
assertTrue(book.isSuperBook());
}
@Test
+ public void testEchoGenericSuperBookProxy2() throws Exception {
+
+ String endpointAddress =
+ "http://localhost:" + PORT + "/webapp/genericstore2";
+ GenericBookStoreSpring2 proxy = JAXRSClientFactory.create(endpointAddress,
+ GenericBookStoreSpring2.class, Collections.singletonList(new JacksonJsonProvider()));
+ WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(1000000000L);
+ SuperBook book = proxy.echoSuperBookJson(new SuperBook("Super", 124L, true));
+ assertEquals(124L, book.getId());
+ assertTrue(book.isSuperBook());
+ }
+
+ @Test
+ public void testEchoGenericSuperBookCollectionProxy2() throws Exception {
+
+ String endpointAddress =
+ "http://localhost:" + PORT + "/webapp/genericstore2";
+ GenericBookStoreSpring2 proxy = JAXRSClientFactory.create(endpointAddress,
+ GenericBookStoreSpring2.class, Collections.singletonList(new JacksonJsonProvider()));
+ List<SuperBook> books =
+ proxy.echoSuperBookCollectionJson(Collections.singletonList(new SuperBook("Super", 124L, true)));
+ assertEquals(124L, books.get(0).getId());
+ assertTrue(books.get(0).isSuperBook());
+ }
+
+ @Test
public void testEchoGenericSuperBookWebClient() throws Exception {
String endpointAddress =
Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml?rev=1515798&r1=1515797&r2=1515798&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml Tue Aug 20 12:32:24 2013
@@ -57,8 +57,19 @@ http://cxf.apache.org/schemas/jaxrs.xsd"
</jaxrs:providers>
</jaxrs:server>
+ <jaxrs:server id="genericBookStore2"
+ address="/genericstore2">
+ <jaxrs:serviceBeans>
+ <ref bean="gBookStore2"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="jackson"/>
+ </jaxrs:providers>
+ </jaxrs:server>
+
<bean id="jackson" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
<bean id="bookstore" class="org.apache.cxf.systest.jaxrs.BookStore"/>
<bean id="bookstore2" class="org.apache.cxf.systest.jaxrs.BookStoreSpring"/>
<bean id="gBookStore" class="org.apache.cxf.systest.jaxrs.GenericBookStoreSpring"/>
+ <bean id="gBookStore2" class="org.apache.cxf.systest.jaxrs.GenericBookStoreSpring2"/>
</beans>