Thanks for the clarification.
I usually ignore Stack Overflow questions to keep CXF users busier/more alive :-), though I did a small clarification to [3].

Thanks, Sergey

On 11/01/16 11:55, Jacob Zwiers wrote:
Sergey, I am not aware of any cases requiring these headers for "plain" 
multipart/mixed.

I had observed a difference in behaviour based on unit tests which were 
examining the response.

 From the discussion in the bug you pointed out [1], I understand that there 
were changes in 2.5.x which made CXF more compliant to RFC 2387 [2].

That's a good enough explanation for me.  I simply wanted to ensure that it wasn't a bug 
or something that required additional configuration.  It doesn't seem to be causing any 
of our "real" clients any trouble.

I had cross-posted to Stack Overflow[3], so feel free to put an answer there 
for some rep.

Appreciate the response and I'm glad for the clarity of understanding.

jz

[1]: https://issues.apache.org/jira/browse/CXF-4348
[2]: http://tools.ietf.org/html/rfc2387
[3]: 
http://stackoverflow.com/questions/34597903/multipartbody-content-type-attributes-dropped-on-cxf-upgrade

-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: January-11-16 6:23 AM
To: [email protected]
Subject: Re: MultipartBody Content-Type attributes dropped on upgrade from CXF 
2.4.0 to 3.4.1

Hi

This is related to
https://issues.apache.org/jira/browse/CXF-4348?focusedCommentId=13488120&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13488120

The only multipart/* media type that may contain 'start' and 'start-info' 
attributes is, AFAIK, multipart/related.

Are you aware of any texts that support these attributes for multipart/mixed ?
Even if it not but you do need these attributes when processing multipart/mixed 
payloads then may be we can update the code to set them but only if a property 
requesting it is set, let me know please

Sergey

On 04/01/16 18:40, Jacob Zwiers wrote:

After upgrading Apache CXF from 2.4.0 to 3.4.1, the `Content-Type` header on 
responses from JAX-RS methods have dropped several attributes.

Under CXF 2.4.0, the header is:

      Content-Type: multipart/mixed; type="application/octet-stream"; 
boundary="uuid:61b631f1-0aa9-4cc8-ad85-3c09129ec442"; start="<DocumentName.ext>"; 
start-info="application/octet-stream"

Under CXF 3.4.1, it is:

      Content-Type: multipart/mixed; 
boundary="uuid:804168d7-70ed-44e7-a471-9647372b9224"

Note: attributes `type`, `start`, `start-info` missing.

Here's the code we're using:

      @GET
      @Path( "{order_id}/document/{document_id}/file" )
      @Produces("multipart/mixed")
      public MultipartBody getDocument( @PathParam( "order_id") int
_orderId,  @PathParam( "document_id") int _documentId) throws
Exception {

         FileInfo fileInfo = findFileInfo( _orderId, _documentId );

         List<Attachment> atts = new ArrayList<Attachment>();

         File internalFile = fileInfo.getActualFile();

         String fileName = fileInfo.getOriginalDocumentName();

         String fileSize = String.valueOf( internalFile.length() );

         ContentDisposition cd = new ContentDisposition("attachment;
filename=\"" + fileName + "\"; size=" + fileSize );

         InputStream inputStreamToUse = new FileInputStream(
internalFile );

         Attachment att = new Attachment(fileName, inputStreamToUse,
cd);

         atts.add( att );

         return new MultipartBody(atts, true);          
      }

I can't find any references in the [Migration Guides][1] to changes in this 
area and the style of the above method seems to match the one from the 
[getBooks2() method in the JAX-RS Multipart documentation][2].

Any guidance on what might be causing the different behaviour?

    [1]: http://cxf.apache.org/docs/migration-guides.html
    [2]:
http://cxf.apache.org/docs/jax-rs-multiparts.html#highlighter_731760



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to