Author: sergeyb Date: Fri Nov 26 22:47:57 2010 New Revision: 1039584 URL: http://svn.apache.org/viewvc?rev=1039584&view=rev Log: Merged revisions 1039508 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.3.x-fixes
................ r1039508 | sergeyb | 2010-11-26 18:48:54 +0000 (Fri, 26 Nov 2010) | 9 lines Merged revisions 1039504 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1039504 | sergeyb | 2010-11-26 18:40:08 +0000 (Fri, 26 Nov 2010) | 1 line [CXF-2958] Support for explicit collections of query or matrix params with proxies ........ ................ Modified: cxf/branches/2.2.x-fixes/ (props changed) cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Propchange: cxf/branches/2.2.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Nov 26 22:47:57 2010 @@ -1,2 +1,2 @@ -/cxf/branches/2.3.x-fixes:1038378,1038416,1038727,1038747 -/cxf/trunk:1038374,1038386,1038722,1038746 +/cxf/branches/2.3.x-fixes:1038378,1038416,1038727,1038747,1039508 +/cxf/trunk:1038374,1038386,1038722,1038746,1039504 Propchange: cxf/branches/2.2.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=1039584&r1=1039583&r2=1039584&view=diff ============================================================================== --- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java (original) +++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java Fri Nov 26 22:47:57 2010 @@ -27,8 +27,11 @@ import java.net.HttpURLConnection; import java.net.URI; import java.net.URL; import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Collection; import java.util.Date; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.ResourceBundle; @@ -462,7 +465,18 @@ public class AbstractClient implements C + "with matrix and query parameters only"); } if (!"".equals(paramName)) { - addToBuilder(ub, paramName, pValue, pt); + + if (InjectionUtils.isSupportedCollectionOrArray(pValue.getClass())) { + Collection<?> c = pValue.getClass().isArray() + ? Arrays.asList((Object[]) pValue) : (Collection) pValue; + for (Iterator<?> it = c.iterator(); it.hasNext();) { + addToBuilder(ub, paramName, it.next(), pt); + } + } else { + addToBuilder(ub, paramName, pValue, pt); + } + + } else { MultivaluedMap<String, Object> values = InjectionUtils.extractValuesFromBean(pValue, ""); Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1039584&r1=1039583&r2=1039584&view=diff ============================================================================== --- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original) +++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Fri Nov 26 22:47:57 2010 @@ -267,6 +267,15 @@ public class BookStore { } @GET + @Path("/segment/matrix-list") + public Book getBookByMatrixListParams(@MatrixParam("first") List<String> list) throws Exception { + if (list.size() != 2) { + throw new RuntimeException(); + } + return doGetBook(list.get(0) + list.get(1)); + } + + @GET @Path("/bookheaders/") public Book getBookByHeader(@HeaderParam("BOOK") List<String> ids) throws Exception { List<MediaType> types = httpHeaders.getAcceptableMediaTypes(); Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1039584&r1=1039583&r2=1039584&view=diff ============================================================================== --- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original) +++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Fri Nov 26 22:47:57 2010 @@ -115,6 +115,16 @@ public class JAXRSClientServerBookTest e } @Test + public void testProxyWithCollectionMatrixParams() throws Exception { + BookStore proxy = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class); + List<String> params = new ArrayList<String>(); + params.add("12"); + params.add("3"); + Book book = proxy.getBookByMatrixListParams(params); + assertEquals(123L, book.getId()); + } + + @Test public void testPropogateException() throws Exception { getAndCompare("http://localhost:" + PORT + "/bookstore/propogateexception", "", "application/xml", 500);
