cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1536756 - in /cxf/branches/2.6.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/
Date Tue, 29 Oct 2013 15:26:46 GMT
Author: sergeyb
Date: Tue Oct 29 15:26:45 2013
New Revision: 1536756

URL: http://svn.apache.org/r1536756
Log:
Merged revisions 1536753 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

................
  r1536753 | sergeyb | 2013-10-29 15:23:37 +0000 (Tue, 29 Oct 2013) | 9 lines
  
  Merged revisions 1536747 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1536747 | sergeyb | 2013-10-29 15:20:15 +0000 (Tue, 29 Oct 2013) | 1 line
    
    [CXF-5347] Making sure matrix params do not interfere with RequestPreprocessor handling
extensions
  ........
................

Added:
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json_matrix.txt
      - copied unchanged from r1536753, cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/expected_atom_book_json_matrix.txt
Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java
    cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/branches/2.7.x-fixes:r1536753
  Merged /cxf/trunk:r1536747

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

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java?rev=1536756&r1=1536755&r2=1536756&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java
Tue Oct 29 15:26:45 2013
@@ -56,6 +56,15 @@ public class PathSegmentImpl implements 
         return path;
     }
     
+    public String getMatrixString() {
+        int index = path.indexOf(';');
+        if (index == -1) {
+            return null;
+        } else {
+            return path.substring(index);
+        }
+    }
+    
     public String toString() {
         return path;
     }

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java?rev=1536756&r1=1536755&r2=1536756&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
Tue Oct 29 15:26:45 2013
@@ -89,23 +89,31 @@ public class RequestPreprocessor {
     }
     
     private void handleLanguageMappings(Message m, UriInfo uriInfo) {
-        String path = uriInfo.getPath(false);
+        if (languageMappings.isEmpty()) {
+            return;
+        }
+        PathSegmentImpl ps = new PathSegmentImpl(uriInfo.getPath(false));
+        String path = ps.getPath();
         for (Map.Entry<?, ?> entry : languageMappings.entrySet()) {
             if (path.endsWith("." + entry.getKey())) {
                 updateAcceptLanguageHeader(m, entry.getValue().toString());
-                updatePath(m, path, entry.getKey().toString());
+                updatePath(m, path, entry.getKey().toString(), ps.getMatrixString());
                 break;
             }    
         }
     }
     
     private void handleExtensionMappings(Message m, UriInfo uriInfo) {
-        String path = uriInfo.getPath(false);
+        if (extensionMappings.isEmpty()) {
+            return;
+        }
+        PathSegmentImpl ps = new PathSegmentImpl(uriInfo.getPath(false));
+        String path = ps.getPath();
         for (Map.Entry<?, ?> entry : extensionMappings.entrySet()) {
             String key = entry.getKey().toString();
             if (path.endsWith("." + key)) {
                 updateAcceptTypeHeader(m, entry.getValue().toString());
-                updatePath(m, path, key);
+                updatePath(m, path, key, ps.getMatrixString());
                 if ("wadl".equals(key)) {
                     // the path has been updated and Accept was not necessarily set to 
                     // WADL type (xml or json or html - other options)
@@ -136,8 +144,11 @@ public class RequestPreprocessor {
             .put(HttpHeaders.ACCEPT_LANGUAGE, acceptLanguage);
     }
     
-    private void updatePath(Message m, String path, String suffix) {
+    private void updatePath(Message m, String path, String suffix, String matrixString) {
         String newPath = path.substring(0, path.length() - (suffix.length() + 1));
+        if (matrixString != null) {
+            newPath += matrixString;
+        }
         HttpUtils.updatePath(m, newPath);
     }
     

Modified: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java?rev=1536756&r1=1536755&r2=1536756&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
(original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAtomBookTest.java
Tue Oct 29 15:26:45 2013
@@ -100,6 +100,10 @@ public class JAXRSAtomBookTest extends A
         getAndCompareJson("http://localhost:" + PORT + "/bookstore/bookstore/books/entries/123.json",
                                "resources/expected_atom_book_json.txt",
                                "*/*");
+        // do the same using extension mappings & matrix parameters
+        getAndCompareJson("http://localhost:" + PORT + "/bookstore/bookstore/books/entries/123.json;a=b",
+                               "resources/expected_atom_book_json_matrix.txt",
+                               "*/*");
         
         
     }



Mime
View raw message