I want to return a zipped file from my server-side java using JAX-RS to the client.
I tried the following code,
@GET
public Response get() throws Exc
In Jersey 2.16 file download is very easy
Below is the example for the ZIP file
@GET
@Path("zipFile")
@Produces("application/zip")
public Response getFile() {
File f = new File(ZIP_FILE_PATH);
if (!f.exists()) {
throw new WebApplicationException(404);
}
return Response.ok(f)
.header("Content-Disposition",
"attachment; filename=server.zip").build();
}