title: rest api to download a file returns contents of file as a response without downloading it
body: <pre><code>    @GET
          @Path("/{loginId}")
          @Produces(MediaType.APPLICATION_OCTET_STREAM)
          public Response downloadExportedFile(@PathParam("loginId") String loginId) {
                  File file = new File("D://abc.txt");
              Response.ResponseBuilder response = Response.ok((Object) file);
              response.header("Content-Disposition", "attachment; filename=newfile.txt");
  response.type(MediaType.APPLICATION_OCTET_STREAM_TYPE);
              return response.build();
          }
  </code></pre>
  
  <p>This gives response as a content of file and not downloading it</p>