cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1333509 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/ rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/ rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/
Date Thu, 03 May 2012 15:40:05 GMT
Author: sergeyb
Date: Thu May  3 15:40:04 2012
New Revision: 1333509

URL: http://svn.apache.org/viewvc?rev=1333509&view=rev
Log:
Merged revisions 1333499 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

................
  r1333499 | sergeyb | 2012-05-03 16:22:39 +0100 (Thu, 03 May 2012) | 9 lines
  
  Merged revisions 1333498 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1333498 | sergeyb | 2012-05-03 16:17:29 +0100 (Thu, 03 May 2012) | 1 line
    
    [CXF-4285] Checking form parameters after all other JAX-RS parameters have been checked
  ........
................

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/FormInterface.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/branches/2.5.x-fixes:r1333499
  Merged /cxf/trunk:r1333498

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

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1333509&r1=1333508&r2=1333509&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
Thu May  3 15:40:04 2012
@@ -383,13 +383,18 @@ public class WadlGenerator implements Re
         if (getMethod(ori).getParameterTypes().length != 0 || classParams.size() != 0) {
             sb.append("<request>");
             handleDocs(anns, sb, DocTarget.REQUEST, false);
-            if (isFormRequest(ori)) {
-                handleFormRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, getFormClass(ori));
-            } else {
-                doHandleClassParams(sb, classParams, ParameterType.QUERY, ParameterType.HEADER);
-                for (Parameter p : ori.getParameters()) {
-                    handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);
+            
+            boolean isForm = isFormRequest(ori);
+            
+            doHandleClassParams(sb, classParams, ParameterType.QUERY, ParameterType.HEADER);
+            for (Parameter p : ori.getParameters()) {
+                if (isForm && p.getType() == ParameterType.REQUEST_BODY) {
+                    continue;
                 }
+                handleParameter(sb, jaxbTypes, qnameResolver, clsMap, ori, p);
+            }
+            if (isForm) {
+                handleFormRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, getFormClass(ori));
             }
             sb.append("</request>");
         }

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/FormInterface.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/FormInterface.java?rev=1333509&r1=1333508&r2=1333509&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/FormInterface.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/FormInterface.java
Thu May  3 15:40:04 2012
@@ -20,6 +20,7 @@ package org.apache.cxf.jaxrs.model.wadl;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.FormParam;
+import javax.ws.rs.HeaderParam;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -44,7 +45,8 @@ public interface FormInterface {
     @POST
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     @Produces(MediaType.TEXT_PLAIN)
-    String form3(@PathParam("id") String id, 
+    String form3(@HeaderParam("headerId") String headerId,
+                 @PathParam("id") String id, 
                  @FormParam("field1") String f1, @FormParam("field2") String f2);
     
     @Path("/form4/{id}")

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java?rev=1333509&r1=1333508&r2=1333509&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
Thu May  3 15:40:04 2012
@@ -457,7 +457,20 @@ public class WadlGeneratorTest extends A
         // verify book-subresource /book resource
         // GET 
         verifyGetResourceMethod(subResourceEls.get(0), bookEl, null);
-        // verify book-subresource /form1 resource
+        
+        verifyFormSubResources(subResourceEls);
+        
+        // verify subresource /chapter/{id}
+        List<Element> chapterMethodEls = getElements(subResourceEls.get(5), "resource",
1);
+        assertEquals("/id", chapterMethodEls.get(0).getAttribute("path"));
+        verifyParameters(subResourceEls.get(5), 1, 
+                         new Param("cid", "template", "xs:int"));
+        // GET
+        verifyGetResourceMethod(chapterMethodEls.get(0), chapterEl, "Get the chapter");
+    }
+    
+    private void verifyFormSubResources(List<Element> subResourceEls) {
+     // verify book-subresource /form1 resource
         List<Element> form1MethodEls = getElements(subResourceEls.get(1), "method",
1);
         
         assertEquals("POST", form1MethodEls.get(0).getAttribute("name"));
@@ -476,14 +489,17 @@ public class WadlGeneratorTest extends A
                          new Param("field1", "query", "xs:string"),
                          new Param("field2", "query", "xs:string"));
         
-        
-        // verify subresource /chapter/{id}
-        List<Element> chapterMethodEls = getElements(subResourceEls.get(5), "resource",
1);
-        assertEquals("/id", chapterMethodEls.get(0).getAttribute("path"));
-        verifyParameters(subResourceEls.get(5), 1, 
-                         new Param("cid", "template", "xs:int"));
-        // GET
-        verifyGetResourceMethod(chapterMethodEls.get(0), chapterEl, "Get the chapter");
+        // verify book-subresource /form2 resource
+        verifyParameters(subResourceEls.get(3), 1, 
+                         new Param("id", "template", "xs:string"));
+        List<Element> form3MethodEls = getElements(subResourceEls.get(3), "method",
1);
+        List<Element> form3RequestEls = getElements(form3MethodEls.get(0), "request",
1);
+        verifyParameters(form3RequestEls.get(0), 1, 
+                         new Param("headerId", "header", "xs:string"));
+        List<Element> form3RequestRepEls = getElements(form3RequestEls.get(0), "representation",
1);
+        verifyParameters(form3RequestRepEls.get(0), 2, 
+                         new Param("field1", "query", "xs:string"),
+                         new Param("field2", "query", "xs:string"));
     }
     
     private List<Element> getElements(Element resource, String name, int expectedSize)
{

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java?rev=1333509&r1=1333508&r2=1333509&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java
Thu May  3 15:40:04 2012
@@ -76,7 +76,7 @@ public class Book implements FormInterfa
         return "";
     }
 
-    public String form3(String identificator, String f1, String f2) {
+    public String form3(String headerId, String identificator, String f1, String f2) {
         return "";
     }
 



Mime
View raw message