cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1449000 - /cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
Date Fri, 22 Feb 2013 11:42:46 GMT
Author: sergeyb
Date: Fri Feb 22 11:42:46 2013
New Revision: 1449000

URL: http://svn.apache.org/r1449000
Log:
[CXF-4848] Minor update

Modified:
    cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java

Modified: cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=1449000&r1=1448999&r2=1449000&view=diff
==============================================================================
--- cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java (original)
+++ cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java Fri Feb
22 11:42:46 2013
@@ -388,7 +388,7 @@ public class WebClient extends AbstractC
      * @return the future
      */
     public <T> Future<T> post(Object body, InvocationCallback<T> callback)
{
-        return doInvokeAsyncCallback("POST", body, body.getClass(), getClass(), callback);
+        return doInvokeAsyncCallback("POST", body, body.getClass(), body.getClass(), callback);
     }
     
     /**
@@ -409,7 +409,7 @@ public class WebClient extends AbstractC
      * @return the future
      */
     public <T> Future<T> put(Object body, InvocationCallback<T> callback)
{
-        return doInvokeAsyncCallback("PUT", body, body.getClass(), getClass(), callback);
+        return doInvokeAsyncCallback("PUT", body, body.getClass(), body.getClass(), callback);
     }
     
     /**
@@ -760,6 +760,13 @@ public class WebClient extends AbstractC
             responseClass, outGenericType);
     }
     
+    private static Type getGenericEntityType(GenericEntity<?> genericEntity, Type inGenericType)
{
+        if (inGenericType != null && genericEntity.getType() != inGenericType) {
+            throw new IllegalArgumentException("Illegal type");    
+        }
+        return genericEntity.getType();
+    }
+    
     protected Response doInvoke(String httpMethod, 
                                 Object body, 
                                 Class<?> requestClass,
@@ -770,10 +777,7 @@ public class WebClient extends AbstractC
             GenericEntity<?> genericEntity = (GenericEntity<?>)body;
             body = genericEntity.getEntity();
             requestClass = genericEntity.getRawType();
-            if (inGenericType != null && genericEntity.getType() != inGenericType)
{
-                throw new IllegalArgumentException("Illegal type");    
-            }
-            inGenericType = genericEntity.getType();
+            inGenericType = getGenericEntityType(genericEntity, inGenericType);
         }
         MultivaluedMap<String, String> headers = prepareHeaders(responseClass, body);
         resetResponse();



Mime
View raw message