Author: sergeyb Date: Tue Nov 29 11:46:10 2011 New Revision: 1207837 URL: http://svn.apache.org/viewvc?rev=1207837&view=rev Log: Merged revisions 1207836 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.4.x-fixes
................ r1207836 | sergeyb | 2011-11-29 11:45:02 +0000 (Tue, 29 Nov 2011) | 9 lines Merged revisions 1207835 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1207835 | sergeyb | 2011-11-29 11:43:07 +0000 (Tue, 29 Nov 2011) | 1 line [CXF-3939] Fixing UriInfo to return the list of matched URIs and resources in the reverse order ........ ................ 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/impl/UriInfoImpl.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 Nov 29 11:46:10 2011 @@ -1,2 +1,2 @@ -/cxf/branches/2.4.x-fixes:1207484 -/cxf/trunk:1207482 +/cxf/branches/2.4.x-fixes:1207484,1207836 +/cxf/trunk:1207482,1207835 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/impl/UriInfoImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriInfoImpl.java?rev=1207837&r1=1207836&r2=1207837&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriInfoImpl.java (original) +++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriInfoImpl.java Tue Nov 29 11:46:10 2011 @@ -22,6 +22,7 @@ package org.apache.cxf.jaxrs.impl; import java.net.URI; import java.util.ArrayList; import java.util.Collections; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.logging.Logger; @@ -156,9 +157,9 @@ public class UriInfoImpl implements UriI public List<Object> getMatchedResources() { if (stack != null) { - List<Object> resources = new ArrayList<Object>(stack.size()); + List<Object> resources = new LinkedList<Object>(); for (MethodInvocationInfo invocation : stack) { - resources.add(invocation.getRealClass()); + resources.add(0, invocation.getRealClass()); } return resources; } @@ -173,7 +174,7 @@ public class UriInfoImpl implements UriI public List<String> getMatchedURIs(boolean decode) { if (stack != null) { List<String> objects = new ArrayList<String>(); - List<String> uris = new ArrayList<String>(stack.size()); + List<String> uris = new LinkedList<String>(); String sum = ""; for (MethodInvocationInfo invocation : stack) { OperationResourceInfo ori = invocation.getMethodInfo(); @@ -189,7 +190,7 @@ public class UriInfoImpl implements UriI } UriBuilder ub = UriBuilder.fromPath(sum); objects.addAll(invocation.getTemplateValues()); - uris.add(ub.build(objects.toArray()).normalize().getPath()); + uris.add(0, ub.build(objects.toArray()).normalize().getPath()); } return uris; } 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=1207837&r1=1207836&r2=1207837&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 Nov 29 11:46:10 2011 @@ -1496,9 +1496,9 @@ public class JAXRSClientServerBookTest e public void testUriInfoMatchedResources() throws Exception { getAndCompare("http://localhost:" + PORT + "/bookstore/" + "booksubresource/123/chapters/sub/1/matched-resources", - "[class org.apache.cxf.systest.jaxrs.BookStore, " + "[class org.apache.cxf.systest.jaxrs.Chapter, " + "class org.apache.cxf.systest.jaxrs.Book, " - + "class org.apache.cxf.systest.jaxrs.Chapter]", + + "class org.apache.cxf.systest.jaxrs.BookStore]", "text/plain", "text/plain", 200); } @@ -1506,17 +1506,17 @@ public class JAXRSClientServerBookTest e public void testUriInfoMatchedResourcesWithObject() throws Exception { getAndCompare("http://localhost:" + PORT + "/bookstore/" + "booksubresource/123/chaptersobject/sub/1/matched-resources", - "[class org.apache.cxf.systest.jaxrs.BookStore, " + "[class org.apache.cxf.systest.jaxrs.Chapter, " + "class org.apache.cxf.systest.jaxrs.Book, " - + "class org.apache.cxf.systest.jaxrs.Chapter]", + + "class org.apache.cxf.systest.jaxrs.BookStore]", "text/plain", "text/plain", 200); } @Test public void testUriInfoMatchedUrisDecode() throws Exception { - String expected = "[/bookstore/booksubresource/123/, " + String expected = "[/bookstore/booksubresource/123/chapters/sub/1/matched!uris, " + "/bookstore/booksubresource/123/chapters/sub/1/, " - + "/bookstore/booksubresource/123/chapters/sub/1/matched!uris]"; + + "/bookstore/booksubresource/123/]"; getAndCompare("http://localhost:" + PORT + "/bookstore/" + "booksubresource/123/chapters/sub/1/matched%21uris?decode=true", expected, "text/plain", "text/plain", 200); @@ -1525,9 +1525,9 @@ public class JAXRSClientServerBookTest e @Test public void testUriInfoMatchedUrisNoDecode() throws Exception { //note '%21' instead of '!' - String expected = "[/bookstore/booksubresource/123/, " + String expected = "[/bookstore/booksubresource/123/chapters/sub/1/matched%21uris, " + "/bookstore/booksubresource/123/chapters/sub/1/, " - + "/bookstore/booksubresource/123/chapters/sub/1/matched%21uris]"; + + "/bookstore/booksubresource/123/]"; getAndCompare("http://localhost:" + PORT + "/bookstore/" + "booksubresource/123/chapters/sub/1/matched%21uris?decode=false", expected,
