I guess there is no other way for creating a FileDateBodyPart than providing a File object:
public FileDataBodyPart(String name, File fileEntity)
But in my case what I have is a byte[] and I don't want to convert it to a file and store on a filesystem.
Is there any other way of generating a multipart (while uploading a file) from an array of byte, inputstream... in the worst case using other client library?
UPDATE: Here is the working code (but I want to use byte[] instead of File):
FileDataBodyPart filePart = new FileDataBodyPart("attachment", new File("C:/TEMP/test.txt"));
MultiPart multipart = new FormDataMultiPart().bodyPart(filePart);
Invocation.Builder invocationBuilder = webTarget.request().accept(MediaType.APPLICATION_JSON);
Response response = invocationBuilder
.buildPost(Entity.entity(multipart, MediaType.MULTIPART_FORM_DATA))
.invoke();