Download a file in xml format in rest api using Java

Viewed 53
@GET
@Path("downloadFile")
@Produces(MediaType.APPLICATION_XML)
public Response downloadFile() 
{
    File file = new File("C:\\......\\CSVdemo.csv");
    return Response.ok(file)
            .type("application/xml")
            .header("Content-Disposition","attachment; FileName= " + file.getName())
            .build();

This the code I have used but When I see the output in postman it does not show the o/p in xml format it shows in generic text format, may i know where I went wrong. And also I don't want to read the contents , I just want to download the file from this given location in xml format.

0 Answers
Related