You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2013/07/09 18:02:58 UTC
svn commit: r1501357 - in /cxf/branches/2.5.x-fixes: ./
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/
rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/
rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/
Author: sergeyb
Date: Tue Jul 9 16:02:58 2013
New Revision: 1501357
URL: http://svn.apache.org/r1501357
Log:
Merged revisions 1501353 via svnmerge from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
................
r1501353 | sergeyb | 2013-07-09 16:58:12 +0100 (Tue, 09 Jul 2013) | 16 lines
Merged revisions 1501342 via svnmerge from
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
................
r1501342 | sergeyb | 2013-07-09 16:44:21 +0100 (Tue, 09 Jul 2013) | 9 lines
Merged revisions 1501339 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1501339 | sergeyb | 2013-07-09 16:41:31 +0100 (Tue, 09 Jul 2013) | 1 line
[CXF-5115] Support for primitive arays
........
................
................
Modified:
cxf/branches/2.5.x-fixes/ (props changed)
cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/branches/2.7.x-fixes:r1501342
Merged /cxf/trunk:r1501339
Merged /cxf/branches/2.6.x-fixes:r1501353
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1501357&r1=1501356&r2=1501357&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Tue Jul 9 16:02:58 2013
@@ -772,6 +772,8 @@ public final class InjectionUtils {
if (o != null) {
if (theValues instanceof Collection) {
Collection.class.cast(theValues).add(o);
+ } else if (theValues.getClass().getComponentType().isPrimitive()) {
+ Array.set(theValues, index, o);
} else {
((Object[]) theValues)[index] = o;
}
Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java?rev=1501357&r1=1501356&r2=1501357&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java (original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java Tue Jul 9 16:02:58 2013
@@ -346,6 +346,16 @@ public class Customer extends AbstractCu
}
@Produces("text/xml")
+ public void testQueryIntegerArray(@QueryParam("query") Integer[] query) {
+ // complete
+ }
+
+ @Produces("text/xml")
+ public void testQueryIntArray(@QueryParam("query") int[] query) {
+ // complete
+ }
+
+ @Produces("text/xml")
public void testQueryAsList(
@DefaultValue("default") @QueryParam("query") List<String> queryString,
@QueryParam("query2") List<String> queryString2,
Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java?rev=1501357&r1=1501356&r2=1501357&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java (original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java Tue Jul 9 16:02:58 2013
@@ -683,6 +683,38 @@ public class JAXRSUtilsTest extends Asse
assertNull(params.get(3));
}
+ @Test
+ public void testQueryParametersIntegerArray() throws Exception {
+ Class<?>[] argType = {Integer[].class};
+ Method m = Customer.class.getMethod("testQueryIntegerArray", argType);
+ MessageImpl messageImpl = new MessageImpl();
+
+ messageImpl.put(Message.QUERY_STRING, "query=1&query=2");
+ List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
+ null,
+ messageImpl);
+ assertEquals(1, params.size());
+ Integer[] intValues = (Integer[])params.get(0);
+ assertEquals(1, (int)intValues[0]);
+ assertEquals(2, (int)intValues[1]);
+ }
+
+ @Test
+ public void testQueryParametersIntArray() throws Exception {
+ Class<?>[] argType = {int[].class};
+ Method m = Customer.class.getMethod("testQueryIntArray", argType);
+ MessageImpl messageImpl = new MessageImpl();
+
+ messageImpl.put(Message.QUERY_STRING, "query=1&query=2");
+ List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
+ null,
+ messageImpl);
+ assertEquals(1, params.size());
+ int[] intValues = (int[])params.get(0);
+ assertEquals(1, intValues[0]);
+ assertEquals(2, intValues[1]);
+ }
+
@SuppressWarnings("unchecked")
@Test
public void testQueryParamAsListWithDefaultValue() throws Exception {