Ok, I figured it out on my own (in Scala).

          val toBodyPart = (src : String) => {
            val file = Paths.get(src)
            Multipart.General.BodyPart(HttpEntity(MediaType.customBinary(
"application", "dicom", MediaType.Compressible), file.toFile().length(), 
FileIO.fromPath(file)))
          }


          val files = List("test1.dcm", "test2.dcm")
          val multipart = Multipart.General.apply(MediaTypes.
`multipart/related`, Source.apply(files.map(f => toBodyPart(f))))
          complete(multipart)




On Thursday, 29 November 2018 12:39:26 UTC+1, Felix Nensa wrote:
>
> Hi,
>
> can anyone give an example or link on how to create a file upload with 
> Content-Type "multipart/related" (preferably in Java)?
> I just find examples for "multipart/form-data" and all the helpers 
> from Multiparts "createFormData..()" seem to be taylored for 
> "multipart/form-data".
>
> Thanks,
>
> Felix
>

-- 
*****************************************************************************************************
** New discussion forum: https://discuss.akka.io/ replacing akka-user 
google-group soon.
** This group will soon be put into read-only mode, and replaced by 
discuss.akka.io
** More details: https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
>>>>>>>>>> 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to