cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1344021 - in /cxf/branches/2.5.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
Date Tue, 29 May 2012 21:56:58 GMT
Author: sergeyb
Date: Tue May 29 21:56:58 2012
New Revision: 1344021

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

........
  r1344018 | sergeyb | 2012-05-29 22:45:15 +0100 (Tue, 29 May 2012) | 1 line
  
  [CXF-4349] Updating the client runtime to check if current types are compatible with the
original ones
........

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
    cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1344018

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

Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java?rev=1344021&r1=1344020&r2=1344021&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
Tue May 29 21:56:58 2012
@@ -23,6 +23,7 @@ import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import java.lang.reflect.Type;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -632,9 +633,13 @@ public class ClientProxyImpl extends Abs
             Object body = objs.get(0);
             try {
                 if (bodyIndex != -1) {
-                    writeBody(body, outMessage, 
-                              method.getParameterTypes()[bodyIndex],
-                              method.getGenericParameterTypes()[bodyIndex],
+                    Class<?> paramClass = method.getParameterTypes()[bodyIndex];
+                    Type paramType = method.getGenericParameterTypes()[bodyIndex];
+                    
+                    boolean isAssignable = paramClass.isAssignableFrom(body.getClass());
+                    writeBody(body, outMessage,
+                              isAssignable ? paramClass : body.getClass(),
+                              isAssignable ? paramType : body.getClass(),
                               anns, headers, os);
                 } else {
                     writeBody(body, outMessage, body.getClass(), body.getClass(), 

Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=1344021&r1=1344020&r2=1344021&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
Tue May 29 21:56:58 2012
@@ -873,10 +873,11 @@ public class WebClient extends AbstractC
                 requestClass = (Class<?>)requestContext.get(REQUEST_CLASS);
                 requestType = (Type)requestContext.get(REQUEST_TYPE);
             }
+            boolean isAssignable = requestClass != null && requestClass.isAssignableFrom(body.getClass());
             try {
                 writeBody(body, outMessage, 
-                          requestClass == null ? body.getClass() : requestClass,
-                          requestType == null ? body.getClass() : requestType, 
+                          requestClass == null || !isAssignable ? body.getClass() : requestClass,
+                          requestType == null || !isAssignable ? body.getClass() : requestType,

                           new Annotation[]{}, headers, os);
                 if (os != null) {
                     os.flush();



Mime
View raw message