cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1063342 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Tue, 25 Jan 2011 16:32:42 GMT
Author: sergeyb
Date: Tue Jan 25 16:32:42 2011
New Revision: 1063342

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

........
  r1063340 | sergeyb | 2011-01-25 16:28:45 +0000 (Tue, 25 Jan 2011) | 1 line
  
  [CXF-3288] Cloning ResponseBuilder during Client.getResponse() calls
........

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/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 25 16:32:42 2011
@@ -1 +1 @@
-/cxf/trunk:1063042,1063205,1063267
+/cxf/trunk:1063042,1063205,1063267,1063340

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=1063342&r1=1063341&r2=1063342&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 Jan 25 16:32:42 2011
@@ -253,7 +253,7 @@ public class AbstractClient implements C
         if (state.getResponseBuilder() == null) {
             return null;
         }
-        return state.getResponseBuilder().build();
+        return state.getResponseBuilder().clone().build();
     }
     
     /**

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1063342&r1=1063341&r2=1063342&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
Tue Jan 25 16:32:42 2011
@@ -57,6 +57,7 @@ import javax.ws.rs.QueryParam;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Cookie;
+import javax.ws.rs.core.EntityTag;
 import javax.ws.rs.core.GenericEntity;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
@@ -392,6 +393,15 @@ public class BookStore {
     }
     
     @GET
+    @Path("/books/response/{bookId}/")
+    @Produces("application/xml")
+    public Response getBookAsResponse(@PathParam("bookId") String id) throws BookNotFoundFault
{
+        Book entity = doGetBook(id);
+        EntityTag etag = new EntityTag(Integer.toString(entity.hashCode()));
+        return Response.ok().tag(etag).entity(entity).build();
+    }
+    
+    @GET
     @Path("/books/{bookId}/cglib")
     @Produces("application/xml")
     public Book getBookCGLIB(@PathParam("bookId") String id) throws BookNotFoundFault {

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1063342&r1=1063341&r2=1063342&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Tue Jan 25 16:32:42 2011
@@ -80,6 +80,21 @@ public class JAXRSClientServerBookTest e
         assertEquals(123L, book.getId());
     }
     
+    @Test
+    public void testGetBookResponseAndETag() throws Exception {
+        
+        String endpointAddress =
+            "http://localhost:" + PORT + "/bookstore/books/response/123"; 
+        WebClient wc = WebClient.create(endpointAddress);
+        Book book = wc.get(Book.class);
+        assertEquals(200, wc.getResponse().getStatus());
+        assertEquals(123L, book.getId());
+        MultivaluedMap<String, Object> headers = wc.getResponse().getMetadata();
+        assertTrue(headers.size() > 0);
+        Object etag = headers.getFirst("ETag");
+        assertNotNull(etag);
+    }
+    
     
     @Test
     public void testOnewayWebClient() throws Exception {



Mime
View raw message