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 38FBA9B9B for ; Mon, 20 May 2013 20:27:02 +0000 (UTC) Received: (qmail 39712 invoked by uid 500); 20 May 2013 20:27:02 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 39660 invoked by uid 500); 20 May 2013 20:27:02 -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 39645 invoked by uid 99); 20 May 2013 20:27:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 May 2013 20:27:02 +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; Mon, 20 May 2013 20:27:00 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D1D0D2388962; Mon, 20 May 2013 20:26:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1484583 - in /cxf/branches/2.5.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ Date: Mon, 20 May 2013 20:26:39 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130520202639.D1D0D2388962@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sergeyb Date: Mon May 20 20:26:39 2013 New Revision: 1484583 URL: http://svn.apache.org/r1484583 Log: Merged revisions 1484582 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes ................ r1484582 | sergeyb | 2013-05-20 21:22:57 +0100 (Mon, 20 May 2013) | 16 lines Merged revisions 1484517 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ................ r1484517 | sergeyb | 2013-05-20 17:32:42 +0100 (Mon, 20 May 2013) | 9 lines Merged revisions 1484513 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1484513 | sergeyb | 2013-05-20 17:21:39 +0100 (Mon, 20 May 2013) | 1 line [CXF-5027] Support for XmlAttachmentRef in the JAX-RS XOP marshaller ........ ................ ................ 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/provider/JAXBAttachmentMarshaller.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/branches/2.7.x-fixes:r1484517 Merged /cxf/trunk:r1484513 Merged /cxf/branches/2.6.x-fixes:r1484582 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/provider/JAXBAttachmentMarshaller.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBAttachmentMarshaller.java?rev=1484583&r1=1484582&r2=1484583&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBAttachmentMarshaller.java (original) +++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBAttachmentMarshaller.java Mon May 20 20:26:39 2013 @@ -20,10 +20,12 @@ package org.apache.cxf.jaxrs.provider; import java.util.Collection; +import java.util.UUID; import javax.activation.DataHandler; import javax.xml.bind.attachment.AttachmentMarshaller; +import org.apache.cxf.attachment.AttachmentImpl; import org.apache.cxf.attachment.AttachmentUtil; import org.apache.cxf.message.Attachment; @@ -70,7 +72,11 @@ public class JAXBAttachmentMarshaller ex @Override public String addSwaRefAttachment(DataHandler handler) { - throw new UnsupportedOperationException(); + String id = UUID.randomUUID() + "@apache.org"; + AttachmentImpl att = new AttachmentImpl(id, handler); + att.setXOP(false); + atts.add(att); + return id; } @Override Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1484583&r1=1484582&r2=1484583&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java Mon May 20 20:26:39 2013 @@ -51,6 +51,7 @@ import org.apache.commons.httpclient.met import org.apache.commons.httpclient.methods.multipart.Part; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.interceptor.LoggingInInterceptor; +import org.apache.cxf.interceptor.LoggingOutInterceptor; import org.apache.cxf.io.CachedOutputStream; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; @@ -358,7 +359,8 @@ public class JAXRSMultipartTest extends HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit(); conduit.getClient().setReceiveTimeout(1000000); conduit.getClient().setConnectionTimeout(1000000); - + WebClient.getConfig(client).getInInterceptors().add(new LoggingInInterceptor()); + WebClient.getConfig(client).getOutInterceptors().add(new LoggingOutInterceptor()); client.type("multipart/related").accept("multipart/related"); XopType xop = new XopType(); @@ -367,6 +369,7 @@ public class JAXRSMultipartTest extends getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/book.xsd"); byte[] data = IOUtils.readBytesFromStream(is); xop.setAttachinfo(new DataHandler(new ByteArrayDataSource(data, "application/octet-stream"))); + xop.setAttachInfoRef(new DataHandler(new ByteArrayDataSource(data, "application/octet-stream"))); String bookXsd = IOUtils.readStringFromStream(getClass().getResourceAsStream( "/org/apache/cxf/systest/jaxrs/resources/book.xsd")); @@ -384,6 +387,8 @@ public class JAXRSMultipartTest extends "/org/apache/cxf/systest/jaxrs/resources/book.xsd")); String bookXsd2 = IOUtils.readStringFromStream(xop2.getAttachinfo().getInputStream()); assertEquals(bookXsdOriginal, bookXsd2); + String bookXsdRef = IOUtils.readStringFromStream(xop2.getAttachInfoRef().getInputStream()); + assertEquals(bookXsdOriginal, bookXsdRef); String ctString = client.getResponse().getMetadata().getFirst("Content-Type").toString(); Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java?rev=1484583&r1=1484582&r2=1484583&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java Mon May 20 20:26:39 2013 @@ -85,6 +85,10 @@ public class MultipartStore { if (!bookXsd.equals(bookXsd2)) { throw new RuntimeException("Wrong attachinfo property"); } + String bookXsdRef = IOUtils.readStringFromStream(type.getAttachInfoRef().getInputStream()); + if (!bookXsdRef.equals(bookXsd2)) { + throw new RuntimeException("Wrong attachinforef property"); + } if (!Boolean.getBoolean("java.awt.headless") && type.getImage() == null) { throw new RuntimeException("Wrong image property"); } @@ -97,7 +101,7 @@ public class MultipartStore { getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/book.xsd"); byte[] data = IOUtils.readBytesFromStream(is); xop.setAttachinfo(new DataHandler(new ByteArrayDataSource(data, "application/octet-stream"))); - + xop.setAttachInfoRef(new DataHandler(new ByteArrayDataSource(data, "application/octet-stream"))); xop.setAttachinfo2(bookXsd.getBytes()); if (Boolean.getBoolean("java.awt.headless")) { Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java?rev=1484583&r1=1484582&r2=1484583&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java Mon May 20 20:26:39 2013 @@ -22,6 +22,7 @@ package org.apache.cxf.systest.jaxrs; import java.awt.Image; import javax.activation.DataHandler; +import javax.xml.bind.annotation.XmlAttachmentRef; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlMimeType; import javax.xml.bind.annotation.XmlRootElement; @@ -32,11 +33,13 @@ import javax.xml.bind.annotation.XmlType "name", "attachinfo", "attachinfo2", + "attachInfoRef", "image" }) public class XopType { private String name; private DataHandler attachinfo; + private DataHandler attachInfoRef; private byte[] attachinfo2; private Image image; @@ -81,4 +84,15 @@ public class XopType { return image; } + @XmlAttachmentRef + @XmlElement(required = true) + @XmlMimeType("application/octet-stream") + public DataHandler getAttachInfoRef() { + return attachInfoRef; + } + + public void setAttachInfoRef(DataHandler attachInfoRef) { + this.attachInfoRef = attachInfoRef; + } + }