cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1057639 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Tue, 11 Jan 2011 14:05:42 GMT
Author: sergeyb
Date: Tue Jan 11 14:05:41 2011
New Revision: 1057639

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

........
  r1057629 | sergeyb | 2011-01-11 13:49:56 +0000 (Tue, 11 Jan 2011) | 1 line
  
  [CXF-3241] Support for CGLIB-enhanced response objects
........

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/interceptor/JAXRSOutInterceptor.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 11 14:05:41 2011
@@ -1 +1 @@
-/cxf/trunk:1057393
+/cxf/trunk:1057393,1057629

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/interceptor/JAXRSOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=1057639&r1=1057638&r2=1057639&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
Tue Jan 11 14:05:41 2011
@@ -45,6 +45,7 @@ import javax.xml.stream.events.XMLEvent;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ClassHelper;
 import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.ext.ResponseHandler;
@@ -402,7 +403,7 @@ public class JAXRSOutInterceptor extends
         if (GenericEntity.class.isAssignableFrom(targetObject.getClass())) {
             return ((GenericEntity)targetObject).getRawType();
         } else {
-            return targetObject.getClass();
+            return ClassHelper.getRealClassFromClass(targetObject.getClass());
         }
     }
     

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=1057639&r1=1057638&r2=1057639&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 11 14:05:41 2011
@@ -23,6 +23,8 @@ package org.apache.cxf.systest.jaxrs;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
 import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
@@ -71,6 +73,7 @@ import javax.xml.namespace.QName;
 import javax.xml.transform.dom.DOMSource;
 
 import org.apache.cxf.annotations.GZIP;
+import org.apache.cxf.common.util.ProxyHelper;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.jaxrs.ext.Oneway;
 import org.apache.cxf.jaxrs.ext.search.SearchCondition;
@@ -389,6 +392,13 @@ public class BookStore {
     }
     
     @GET
+    @Path("/books/{bookId}/cglib")
+    @Produces("application/xml")
+    public Book getBookCGLIB(@PathParam("bookId") String id) throws BookNotFoundFault {
+        return createCglibProxy(doGetBook(id));
+    }
+    
+    @GET
     @Path("/the books/{bookId}/")
     @Produces("application/xml")
     public Book getBookWithSpace(@PathParam("bookId") String id) throws BookNotFoundFault
{
@@ -895,6 +905,20 @@ public class BookStore {
         } 
         
     }
+    
+    private Book createCglibProxy(final Book book) {
+        final InvocationHandler handler = new InvocationHandler() {
+
+            @Override
+            public Object invoke(Object object, Method method, Object[] args) throws Throwable
{
+                return method.invoke(book, args);
+            }
+            
+        };
+        return (Book)ProxyHelper.getProxy(this.getClass().getClassLoader(), 
+                                    new Class[]{Book.class}, 
+                                    handler);
+    }
 }
 
 

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=1057639&r1=1057638&r2=1057639&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 11 14:05:41 2011
@@ -628,6 +628,13 @@ public class JAXRSClientServerBookTest e
     }
     
     @Test
+    public void testGetBook123CGLIB() throws Exception {
+        getAndCompareAsStrings("http://localhost:" + PORT + "/bookstore/books/123/cglib",
+                               "resources/expected_get_book123.txt",
+                               "application/xml", 200);
+    }
+    
+    @Test
     public void testGetBook123() throws Exception {
         getAndCompareAsStrings("http://localhost:" + PORT + "/bookstore/books/123",
                                "resources/expected_get_book123.txt",



Mime
View raw message