Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D03E6D390 for ; Wed, 31 Oct 2012 19:22:11 +0000 (UTC) Received: (qmail 87472 invoked by uid 500); 31 Oct 2012 19:22:11 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 87392 invoked by uid 500); 31 Oct 2012 19:22:11 -0000 Mailing-List: contact issues-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 issues@cxf.apache.org Received: (qmail 87384 invoked by uid 99); 31 Oct 2012 19:22:11 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2012 19:22:11 +0000 Date: Wed, 31 Oct 2012 19:22:11 +0000 (UTC) From: "Sergey Beryozkin (JIRA)" To: issues@cxf.apache.org Message-ID: <685741754.52532.1351711331717.JavaMail.jiratomcat@arcas> In-Reply-To: <1859290370.10587.1338290664445.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Commented] (CXF-4348) Content-Type is broken in multipart serialization MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-4348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488127#comment-13488127 ] Sergey Beryozkin commented on CXF-4348: --------------------------------------- FYI: http://svn.apache.org/viewvc?rev=1404308&view=rev > Content-Type is broken in multipart serialization > ------------------------------------------------- > > Key: CXF-4348 > URL: https://issues.apache.org/jira/browse/CXF-4348 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Environment: Any > Reporter: Ivan Bondarenko > Assignee: Sergey Beryozkin > Priority: Blocker > Labels: bug, multipart, serialization > Fix For: 2.5.5, 2.6.2, 2.7.0 > > > Multiparts are serialized incorrectly. > Imagine the response with two attachments: > a) "filename1.doc" with attachment-id "Attachment_id1" and Content-Type "application/msword" > b) "filename2.xls" with attachment-id "Attachment_id2" and Content-Type "application/vnd.ms-excel" > Serialization of this Multipart is ({} are used for text reduction): > HTTP/1.1 200 OK > Server: ... > Date: ... > Content-Type: application/octet-stream; type="application/msword"; boundary="uuid:{UUID}"; start=""; start-info="application/msword" > Transfer-Encoding: chunked > --uuid:{UUID} > Content-Type: text/xml; charset=UTF-8; type="application/msword"; > Content-Transfer-Encoding: binary > Content-ID: > Content-Disposition: attachment; filename=filename1.doc > {CONTENT1} > --uuid:{UUID} > Content-Type: application/vnd.ms-excel > Content-Transfer-Encoding: binary > Content-ID: > Content-Disposition: attachment; filename=filename2.xls > {CONTENT2} > --uuid:{UUID}-- > While we are expecting kind of this: > HTTP/1.1 200 OK > Server: ... > Date: ... > Content-Type: multipart/related > Transfer-Encoding: chunked > --uuid:{UUID} > Content-Type: application/msword; > Content-Transfer-Encoding: binary > Content-ID: > Content-Disposition: attachment; filename=filename1.doc > {CONTENT1} > --uuid:{UUID} > Content-Type: application/vnd.ms-excel > Content-Transfer-Encoding: binary > Content-ID: > Content-Disposition: attachment; filename=filename2.xls > {CONTENT2} > --uuid:{UUID}-- > So the Content-Type of the whole response and of the first part are incorrect. > The starting point of the bug searching is org.apache.cxf.jaxrs.ext.MessageContextImpl.convertToAttachments(Object) method, which has at least these sub-bugs: > 1) First attachment is handled other way than all subsequent ones -> All attachments must be handled in the same way. > 2) AttachmentOutputInterceptor is created with some default Contetnt-Type, which is "application/octet-stream" -> The type must be "multipart/related" (or other multipart). > 3) Content-Type of outMessage is changed to the first attachment's Content-Type and then new type is used at least in org.apache.cxf.attachment.AttachmentSerializer.writeProlog() method -> The same type must be used. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira