cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r768926 - in /cxf/trunk: rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ systests/src/test/java/org/apache/cxf/systest/jaxrs/
Date Mon, 27 Apr 2009 11:22:16 GMT
Author: sergeyb
Date: Mon Apr 27 11:22:16 2009
New Revision: 768926

URL: http://svn.apache.org/viewvc?rev=768926&view=rev
Log:
JAXRS: support for multiple matrix params in the last segment

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=768926&r1=768925&r2=768926&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Mon Apr 27 11:22:16 2009
@@ -332,7 +332,7 @@
             reqPrefix = UrlUtils.pathDecode(reqPrefix);
             // pathInfo drops matrix parameters attached to a last path segment
             int offset = 0;
-            int index = reqPrefix.lastIndexOf(';');
+            int index = getMatrixParameterIndex(reqPrefix, pathInfo.length());
             if (index >= pathInfo.length()) {
                 offset = reqPrefix.length() - index;
             }
@@ -340,6 +340,17 @@
         }
         return reqPrefix;
     }
+    
+    private int getMatrixParameterIndex(String reqPrefix, int pathInfoLength) {
+        int index = reqPrefix.lastIndexOf(';');
+        int lastIndex = -1;
+        while (index >= pathInfoLength) {
+            lastIndex = index;
+            reqPrefix = reqPrefix.substring(0, index);
+            index = reqPrefix.lastIndexOf(';');
+        }
+        return lastIndex;
+    }
 
     protected void generateNotFound(HttpServletRequest request, HttpServletResponse res)
throws IOException {
         res.setStatus(404);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java?rev=768926&r1=768925&r2=768926&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresource.java Mon
Apr 27 11:22:16 2009
@@ -47,6 +47,7 @@
     Book getTheBook2(@PathParam("n1") String name1,
                      @QueryParam("n2") String name2,
                      @MatrixParam("n3") String name3,
+                     @MatrixParam("n33") String name33,
                      @HeaderParam("N4") String name4,
                      @CookieParam("n5") String name5,
                      String name6) throws BookNotFoundFault;

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java?rev=768926&r1=768925&r2=768926&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookSubresourceImpl.java
Mon Apr 27 11:22:16 2009
@@ -45,12 +45,13 @@
         return b;
     }
 
-    public Book getTheBook2(String n1, String n2, String n3, String n4, String n5, String
n6) 
+    public Book getTheBook2(String n1, String n2, String n3, String n33, 
+                            String n4, String n5, String n6) 
         throws BookNotFoundFault {
         
         Book b = new Book();
         b.setId(id); 
-        b.setName(n1 + n2 + n3 + n4 + n5 + n6);
+        b.setName(n1 + n2 + n3 + n33 + n4 + n5 + n6);
         return b;
     }
     

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=768926&r1=768925&r2=768926&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java Mon
Apr 27 11:22:16 2009
@@ -212,7 +212,7 @@
         client.type(MediaType.TEXT_PLAIN_TYPE).accept(MediaType.APPLICATION_XML_TYPE);
         BookSubresource proxy = JAXRSClientFactory.fromClient(client, BookSubresource.class);
         
-        Book b = proxy.getTheBook2("CXF ", "in ", "Action ", "- 3", "7", "8");
+        Book b = proxy.getTheBook2("CXF ", "in ", "Acti", "on ", "- 3", "7", "8");
         assertEquals(378, b.getId());
         assertEquals("CXF in Action - 378", b.getName());
         
@@ -221,12 +221,12 @@
     private void doTestSubresource(BookStoreJaxrsJaxws proxy) throws Exception {
         BookSubresource bs = proxy.getBookSubresource("378");
         
-        Book b = bs.getTheBook2("CXF ", "in ", "Action ", "- 3", "7", "8");
+        Book b = bs.getTheBook2("CXF ", "in ", "Acti", "on ", "- 3", "7", "8");
         assertEquals(378, b.getId());
         assertEquals("CXF in Action - 378", b.getName());
         
         WebClient.client(bs).reset().header("N4", "- 4");
-        b = bs.getTheBook2("CXF ", "in ", "Action ", null, "7", "8");
+        b = bs.getTheBook2("CXF ", "in ", "Acti", "on ", null, "7", "8");
         assertEquals(378, b.getId());
         assertEquals("CXF in Action - 478", b.getName());
         



Mime
View raw message