title: How to create Multipart Response
body: <p>I am working on restful web services where I want to generate Multipart response in below format:</p>
  
  <pre><code>HTTP/1.1 200 OK  
  Server:  
  MIME version:  
  Content-type:Multipart/form-data  
  Content-length:500; boundary=  
  --Boundary--
  
  content-type:  
  content-Disposition: ;name="abc"  
  
  [content]  
  --Boundary--  
  content-Disposition: ;name="cba"  
  
  [content]  
  --Boundary--  
  </code></pre>
  
  <p>This reponse will contains results of queries and wont contain any url.</p>
  
  <p>I have used MimeMultipart:</p>
  
  <pre><code>MimeMultipart multipart = new MimeMultipart();
  // ...add files to multipart
  MimeBodyPart firstPart = new MimeBodyPart();      
  imagePart.setContent(Object, MediaType.APPLICATION_OCTET_STREAM);
  
      MimeBodyPart secondnPart = new MimeBodyPart();
      jsonPart.setContent(Object, MediaType.APPLICATION_JSON);
  
      multiPart.addBodyPart(firstPart);
      multiPart.addBodyPart(secondPart);
  return Response.ok(multipart, "multipart/form-data").build();
  </code></pre>
  
  <p>But that doesn't create in the above format. I am using Spring framework for implementation. Not getting the header.   </p>