I Am new to jersey/JAX-RS implementation. Please find below my jersey client code to download file:
 Client client = Client.create();
 WebResource wr = client.resource("http://localhost:7070/upload-0.0.1-SNAPSHOT/rest/files/download");
 Builder wb=wr.accept("application/json,application/pdf,text/plain,image/jpeg,application/xml,application/vnd.ms-excel");
 ClientResponse clientResponse= wr.get(ClientResponse.class);
 System.out.println(clientResponse.getStatus());
 File res= clientResponse.getEntity(File.class);
 File downloadfile = new File("C://Data/test/downloaded/testnew.pdf");  
 res.renameTo(downloadfile);
 FileWriter fr = new FileWriter(res);
 fr.flush();
My Server side code is :
@Path("/download")
    @GET
    @Produces({"application/pdf","text/plain","image/jpeg","application/xml","application/vnd.ms-excel"})
    public Response getFile()
    {
        File download = new File("C://Data/Test/downloaded/empty.pdf");
        ResponseBuilder response = Response.ok((Object)download);
        response.header("Content-Disposition", "attachment; filename=empty.pdf");
        return response.build();
    }
In my client code i am getting response as 200 OK,but i am unable to save my file on hard disk In the below line i am mentioning the path and location where the files need to be saved. Not sure whats going wrong here,any help would be appreciated.Thanks in advance!!
File downloadfile = new File("C://Data/test/downloaded/testnew.pdf");