Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0A760D9FF for ; Thu, 13 Dec 2012 12:35:26 +0000 (UTC) Received: (qmail 74884 invoked by uid 500); 13 Dec 2012 12:35:25 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 74757 invoked by uid 500); 13 Dec 2012 12:35:25 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 74744 invoked by uid 99); 13 Dec 2012 12:35:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Dec 2012 12:35:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Dec 2012 12:35:23 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7DA1B238896F; Thu, 13 Dec 2012 12:35:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1421253 - in /cxf/branches/2.6.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/ Date: Thu, 13 Dec 2012 12:35:02 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121213123503.7DA1B238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sergeyb Date: Thu Dec 13 12:35:02 2012 New Revision: 1421253 URL: http://svn.apache.org/viewvc?rev=1421253&view=rev Log: Merged revisions 1421245,1421247 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1421245 | sergeyb | 2012-12-13 12:27:08 +0000 (Thu, 13 Dec 2012) | 1 line [CXF-4697] Fixing MultipartProvider to correctly read Maps by applying a quality patch from William Tam ........ r1421247 | sergeyb | 2012-12-13 12:30:57 +0000 (Thu, 13 Dec 2012) | 1 line [CXF-4697] Adding a test resource ........ Added: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentFormMixed - copied unchanged from r1421247, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentFormMixed 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/provider/MultipartProvider.java cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java Propchange: cxf/branches/2.6.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/trunk:r1421245-1421247 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/provider/MultipartProvider.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java?rev=1421253&r1=1421252&r2=1421253&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java (original) +++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java Thu Dec 13 12:35:02 2012 @@ -142,7 +142,7 @@ public class MultipartProvider extends A && AnnotationUtils.getAnnotation(anns, Multipart.class) == null) { return getAttachmentCollection(t, infos, anns); } - if (Map.class.isAssignableFrom(c)) { + if (c.isAssignableFrom(Map.class)) { Map map = new LinkedHashMap(infos.size()); Class actual = getActualType(t, 1); for (Attachment a : infos) { Modified: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1421253&r1=1421252&r2=1421253&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java (original) +++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java Thu Dec 13 12:35:02 2012 @@ -244,6 +244,12 @@ public class JAXRSMultipartTest extends } @Test + public void testAddBookMixedMultiValueMapParameter() throws Exception { + String address = "http://localhost:" + PORT + "/bookstore/books/mixedmultivaluedmap"; + doAddBook("multipart/mixed", address, "attachmentFormMixed", 200); + } + + @Test public void testAddBookAsJAXBJSON() throws Exception { String address = "http://localhost:" + PORT + "/bookstore/books/jaxbjson"; doAddBook(address, "attachmentData2", 200); Modified: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java?rev=1421253&r1=1421252&r2=1421253&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java (original) +++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java Thu Dec 13 12:35:02 2012 @@ -652,6 +652,36 @@ public class MultipartStore { throw new WebApplicationException(); } + @POST + @Path("/books/mixedmultivaluedmap") + @Consumes("multipart/mixed") + @Produces("text/xml") + public Response addBookFromFormConsumesMixed( + @Multipart(value = "mapdata", type = MediaType.APPLICATION_FORM_URLENCODED) + MultivaluedMap data, + @Multipart(value = "test-cid", type = MediaType.APPLICATION_XML) + String testXml) throws Exception { + if (!"Dreams".equals(data.get("id-name").get(0))) { + throw new Exception("Map entry 0 does not match"); + } + if (!"True".equals(data.get("entity-name").get(0))) { + throw new Exception("Map entry 1 does not match"); + } + if (!"NAT5\n".equals(data.get("native-id").get(0))) { + throw new Exception("Map entry 2 does not match"); + } + if (data.size() != 3) { + throw new Exception("Map size does not match"); + } + if ("World2".equals(testXml)) { + throw new Exception("testXml does not match"); + } + + Book b = new Book(); + b.setId(124); + b.setName("CXF in Action - 2"); + return Response.ok(b).build(); + } private Response readBookFromInputStream(InputStream is) throws Exception { JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class}); Unmarshaller u = c.createUnmarshaller();