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

Reply via email to