title: Setting multiple images to the response entity
body: <p>I want to return response with multiple images to client. And in client side i want to download those images. I haven't find any method like .setEntity() for HttpServletResponse. So i have decided to add images in header fields. I am adding in following way,</p>
  
  <pre><code>File sourceFile = new File(serverLocation + "/" + filename);
  
  servletresponse.setContentType(new MimetypesFileTypeMap().getContentType(sourceFile));
  servletresponse.setContentLength((int)sourceFile.length());
  servletresponse.setHeader(filename, "attachment; filename=" + URLEncoder.encode(filename, "UTF-8"));
  </code></pre>
  
  <p>I am unable to download on client side. This is what i am doing on client side,</p>
  
  <pre><code>CloseableHttpResponse response = httpclient.execute(httppost);
  Header[] headers = response.getAllHeaders();
              for (int i = 0; i &lt; headers.length; i++) {
                  if (headers[i].getName().equals(filename)) {
                      imagename = headers[i].getValue();
                  }
              }
  InputStream fileInputStream = new ByteArrayInputStream(imagename.getBytes(StandardCharsets.UTF_8));
              byte[] bufffer = new byte[512];
              while ((bufferSize = fileInputStream.read(bufffer)) &gt; 0) {
                  fileOutputStream.write(bufffer, 0, bufferSize);
              }
  </code></pre>
  
  <p>However its not writing images. How can i add multiple files and download it on client side. Please help.</p>