cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [05/48] cxf git commit: Few updates to JAXRS client proxy async code
Date Wed, 29 Jun 2016 22:44:03 GMT
Few updates to JAXRS client proxy async code


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9628872a
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9628872a
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9628872a

Branch: refs/heads/master-jaxrs-2.1
Commit: 9628872a1e11f9bad20d4c5c93681a6849cd29b6
Parents: 32a37d0
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Jun 8 15:45:47 2016 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Jun 8 15:45:47 2016 +0100

----------------------------------------------------------------------
 .../cxf/jaxrs/client/ClientProxyImpl.java       | 31 ++++++--------------
 1 file changed, 9 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9628872a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
index 1e1d427..c5bb980 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
@@ -793,8 +793,7 @@ public class ClientProxyImpl extends AbstractClient implements
         Class<?> callbackRespClass = getCallbackClass(callbackOutType);
         
         Class<?> methodReturnType = ori.getMethodToInvoke().getReturnType();
-        if (callbackRespClass == Response.class 
-            || callbackRespClass.isAssignableFrom(methodReturnType)
+        if (callbackRespClass.isAssignableFrom(methodReturnType)
             || PrimitiveUtils.canPrimitiveTypeBeAutoboxed(methodReturnType, callbackRespClass))
{
             return callback;    
         } else {
@@ -949,28 +948,16 @@ public class ClientProxyImpl extends AbstractClient implements
     class ClientAsyncResponseInterceptor extends AbstractClientAsyncResponseInterceptor {
         @Override
         protected void doHandleAsyncResponse(Message message, Response r, JaxrsClientCallback<?>
cb) {
-            Object entity = null;
-            if (r == null) {
-                try {
-                    entity = handleResponse(message.getExchange().getOutMessage(),
-                                            cb.getResponseClass());
-                } catch (Throwable t) {
-                    cb.handleException(message, t);
-                    return;
-                } finally {
-                    completeExchange(message.getExchange(), false);
-                }
-            }
-            if (cb.getResponseClass() == null || Response.class.equals(cb.getResponseClass()))
{
-                cb.handleResponse(message, new Object[] {r});
-            } else if (r != null && r.getStatus() >= 300) {
-                cb.handleException(message, convertToWebApplicationException(r));
-            } else {
-                cb.handleResponse(message, new Object[] {entity});
+            try {
+                Object entity = handleResponse(message.getExchange().getOutMessage(),
+                                               cb.getResponseClass());
+                cb.handleResponse(message, new Object[] {entity});    
+            } catch (Throwable t) {
+                cb.handleException(message, t);
+            } finally {
+                completeExchange(message.getExchange(), false);
                 closeAsyncResponseIfPossible(r, message, cb);
             }
         }
-        
-        
     }
 }


Mime
View raw message