Upload multiple files using CXF JAX-RS

I have a requirement where I want to pass multiple thumbnails to UI ( javascript

) as a GET

Request response . Each thumbnail is a separate file, so essentially I want to transfer multiple files. Does downloading multiple files even a sane idea? If so, how can we use CXF JAX-RS ? I tried below code which doesn't work.

@GET
@Path("/streamThumbnails")
@Produces("multipart/mixed")
   public MultipartBody getBooks2() {
      List<Attachment> atts = new LinkedList<Attachment>();
      File thumbnail1 = new File("//D:/pdf2.pdf");
      File thumbnail2 = new File("//D:/pdf3.pdf");
      atts.add(new Attachment("thumbnail1", "application/pdf",thumbnail1));
      atts.add(new Attachment("thumbnail2", "application/pdf",thumbnail2));
      return new MultipartBody(atts, true);  
   }

      

+3


source to share


1 answer


Since you're talking about thumbnails, I think you want to upload images, not PDFs like in your example. Why not combine them into a single image and use them as CSS sprites ?



0


source







All Articles