cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1491745 - in /cxf/trunk: distribution/src/main/release/samples/jax_rs/basic/src/main/java/demo/jaxrs/server/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ systests/j...
Date Tue, 11 Jun 2013 11:24:49 GMT
Author: sergeyb
Date: Tue Jun 11 11:24:49 2013
New Revision: 1491745

URL: http://svn.apache.org/r1491745
Log:
[CXF-5065] Setting subresource parent before the subresource gets evaluated

Modified:
    cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/main/java/demo/jaxrs/server/Order.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java

Modified: cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/main/java/demo/jaxrs/server/Order.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/main/java/demo/jaxrs/server/Order.java?rev=1491745&r1=1491744&r2=1491745&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/main/java/demo/jaxrs/server/Order.java
(original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/src/main/java/demo/jaxrs/server/Order.java
Tue Jun 11 11:24:49 2013
@@ -55,7 +55,6 @@ public class Order {
 
     @GET
     @Path("products/{productId}/")
-    @Produces("text/xml")   
     public Product getProduct(@PathParam("productId")int productId) {
         System.out.println("----invoking getProduct with id: " + productId);
         Product p = products.get(new Long(productId));

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java?rev=1491745&r1=1491744&r2=1491745&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java
Tue Jun 11 11:24:49 2013
@@ -149,10 +149,9 @@ public class ClassResourceInfo extends B
         SubresourceKey key = new SubresourceKey(typedClass, instanceClass);
         ClassResourceInfo cri = subResources.get(key);
         if (cri == null) {
-            cri = ResourceUtils.createClassResourceInfo(typedClass, instanceClass, false,
resolveContexts,
+            cri = ResourceUtils.createClassResourceInfo(typedClass, instanceClass, this,
false, resolveContexts,
                                                         getBus());
             if (cri != null) {
-                cri.setParent(this);
                 subResources.putIfAbsent(key, cri);
             }
         }
@@ -183,9 +182,6 @@ public class ClassResourceInfo extends B
         subResources.putIfAbsent(new SubresourceKey(cri.getResourceClass(), 
                                             cri.getServiceClass()),
                                  cri);
-        if (cri != this) {
-            cri.setParent(this);
-        }
     }
     
     public Collection<ClassResourceInfo> getSubResources() {
@@ -287,7 +283,7 @@ public class ClassResourceInfo extends B
         }
     }
 
-    void setParent(ClassResourceInfo parent) {
+    public void setParent(ClassResourceInfo parent) {
         this.parent = parent;
     }
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java?rev=1491745&r1=1491744&r2=1491745&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
Tue Jun 11 11:24:49 2013
@@ -232,7 +232,17 @@ public final class ResourceUtils {
                                                             boolean root, 
                                                             boolean enableStatic,
                                                             Bus bus) {
+        return createClassResourceInfo(rClass, sClass, null, root, enableStatic, bus);
+    }
+    
+    public static ClassResourceInfo createClassResourceInfo(final Class<?> rClass,

+                                                            final Class<?> sClass,
+                                                            ClassResourceInfo parent,
+                                                            boolean root, 
+                                                            boolean enableStatic,
+                                                            Bus bus) {
         ClassResourceInfo cri = new ClassResourceInfo(rClass, sClass, root, enableStatic,
bus);
+        cri.setParent(parent);
 
         if (root) {
             URITemplate t = URITemplate.createTemplate(cri.getPath());
@@ -261,7 +271,7 @@ public final class ResourceUtils {
                         ClassResourceInfo subCri = cri.findResource(subClass, subClass);
                         if (subCri == null) {
                             subCri = subClass == cri.getServiceClass() ? cri
-                                     : createClassResourceInfo(subClass, subClass, false,
enableStatic,
+                                     : createClassResourceInfo(subClass, subClass, cri, false,
enableStatic,
                                                                cri.getBus());
                         }
                         

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java?rev=1491745&r1=1491744&r2=1491745&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java
Tue Jun 11 11:24:49 2013
@@ -66,6 +66,7 @@ public interface BookSubresource {
     
     @POST
     @Path("/subresource3")
+    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     Book getTheBook3(@FormParam("id") String id,
                      @FormParam("name") List<String> nameParts) throws BookNotFoundFault;
     



Mime
View raw message