I have one API in which I have to send a response which contains one binary,
I tried some example from StackOverflow but I did not get any solution.
I tried In Jersey
@POST
@Path("/testmultipart")
@Consumes("application/json")
@Produces("multipart/mixed")
public Response multipartTest() throws URISyntaxException, MessagingException, IOException
{
File image = new File("C:\\Users\\ganesh\\img\\logo.png");
MultiPart objMultiPart = new MultiPart();
objMultiPart.type(new MediaType("multipart", "mixed"));
objMultiPart.bodyPart(image.getName(), new MediaType("text", "plain"));
objMultiPart.bodyPart("" + image.length(), new MediaType("text","plain"));
objMultiPart.bodyPart(image, new MediaType("multipart", "mixed"));
return Response.ok(objMultiPart).build();
}
But no luck can you please help.