title: Return file in Spring MVC REST
body: <p>I have the REST Service Code  Below code which returns a File ,now the problem is in the response body on the PostMan Client I get a raw response ,how can I can convert it so that it displays the contents of the file to the client ,Goal is to return a file to the user .File Name is "File1.jpeg"</p>
  
  <p>Code:</p>
  
  <pre><code>@RequestMapping(value = URIConstansts.GET_FILE, produces = { "application/json" }, method = RequestMethod.GET)
  public @ResponseBody ResponseEntity getFile(@RequestParam(value="fileName", required=false) String fileName,HttpServletRequest request) throws IOException{
  
      ResponseEntity respEntity = null;
  
      byte[] reportBytes = null;
      File result=new File("/home/arpit/Documents/PCAP/dummyPath/"+fileName);
  
      if(result.exists()){
          InputStream inputStream = new FileInputStream("/home/arpit/Documents/PCAP/dummyPath/"+fileName); 
  
  
          byte[]out=org.apache.commons.io.IOUtils.toByteArray(inputStream);
  
          HttpHeaders responseHeaders = new HttpHeaders();
          responseHeaders.add("content-disposition", "attachment; filename=" + fileName);
  
          respEntity = new ResponseEntity(out, responseHeaders,HttpStatus.OK);
  
  
      }else{
  
          respEntity = new ResponseEntity ("File Not Found", HttpStatus.OK);
      }
  
  
      return respEntity;
  
  }
  </code></pre>