cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1084243 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ rt/ws/security/
Date Tue, 22 Mar 2011 16:36:48 GMT
Author: sergeyb
Date: Tue Mar 22 16:36:48 2011
New Revision: 1084243

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

........
  r1084241 | sergeyb | 2011-03-22 16:33:37 +0000 (Tue, 22 Mar 2011) | 1 line
  
  [JAX-RS] Avoid checking HttpURLConnection for the status code on the client side
........

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

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 22 16:36:48 2011
@@ -1 +1 @@
-/cxf/trunk:1083736,1083742,1083826,1084168
+/cxf/trunk:1083736,1083742,1083826,1084168,1084241

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

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=1084243&r1=1084242&r2=1084243&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
Tue Mar 22 16:36:48 2011
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.jaxrs.client;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
@@ -408,30 +407,27 @@ public class AbstractClient implements C
     }
     
     @SuppressWarnings("unchecked")
-    protected Object readBody(Response r, HttpURLConnection conn, Message outMessage, Class<?>
cls, 
+    protected Object readBody(Response r, Message inMessage, Class<?> cls, 
                               Type type, Annotation[] anns) {
 
         InputStream inputStream = (InputStream)r.getEntity();
         if (inputStream == null) {
             return cls == Response.class ? r : null;
         }
-        try {
-            int status = conn.getResponseCode();
-            if (status < 200 || status == 204 || status > 300) {
-                Object length = r.getMetadata().getFirst(HttpHeaders.CONTENT_LENGTH);
-                if (length == null || Integer.parseInt(length.toString()) == 0
-                    || status >= 400) {
-                    return cls == Response.class ? r : status >= 400 ? inputStream : null;
-                }
+        
+        int status = r.getStatus();
+        if (status < 200 || status == 204 || status > 300) {
+            Object length = r.getMetadata().getFirst(HttpHeaders.CONTENT_LENGTH);
+            if (length == null || Integer.parseInt(length.toString()) == 0
+                || status >= 400) {
+                return cls == Response.class ? r : status >= 400 ? inputStream : null;
             }
-        } catch (IOException ex) {
-            // won't happen at this stage
         }
         
         MediaType contentType = getResponseContentType(r);
         
-        MessageBodyReader mbr = ProviderFactory.getInstance(outMessage).createMessageBodyReader(
-            cls, type, anns, contentType, outMessage);
+        MessageBodyReader mbr = ProviderFactory.getInstance(inMessage).createMessageBodyReader(
+            cls, type, anns, contentType, inMessage);
         if (mbr != null) {
             try {
                 return mbr.readFrom(cls, type, anns, contentType, 

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java?rev=1084243&r1=1084242&r2=1084243&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
Tue Mar 22 16:36:48 2011
@@ -460,7 +460,7 @@ public class ClientProxyImpl extends Abs
             return r;
         }
         
-        return readBody(r, connect, outMessage, method.getReturnType(), 
+        return readBody(r, outMessage, method.getReturnType(), 
                         method.getGenericReturnType(), method.getDeclaredAnnotations());
     }
 

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=1084243&r1=1084242&r2=1084243&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
Tue Mar 22 16:36:48 2011
@@ -634,7 +634,7 @@ public class WebClient extends AbstractC
             ResponseBuilder rb = setResponseBuilder(conn, outMessage.getExchange());
             Response currentResponse = rb.clone().build();
             
-            Object entity = readBody(currentResponse, conn, outMessage, responseClass, genericType,
+            Object entity = readBody(currentResponse, outMessage, responseClass, genericType,
                                      new Annotation[]{});
             rb.entity(entity instanceof Response 
                       ? ((Response)entity).getEntity() : entity);

Propchange: cxf/branches/2.3.x-fixes/rt/ws/security/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 22 16:36:48 2011
@@ -1 +1 @@
-/cxf/trunk/rt/ws/security:1083736,1083742,1083826,1084160,1084168
+/cxf/trunk/rt/ws/security:1083736,1083742,1083826,1084160,1084168,1084241



Mime
View raw message