I want to add a GET request to my Dropwizard app so that a file is returned which was retrieved from a Minio server.
Consider
@Path("/file")
public class FileResource {
@GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response getFile() throws Exception {
InputStream is = minioClient.getObject("mybucket", "myobject");
// timeout?
return Response.ok(is)
.header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"file.txt\"")
.build();
}
}
What happens with the Dropwizard GET request then retrieving the file from Minio takes takes to long e.g. slow network?
Is it correct that the servlet container copies the file from Minio to the client and if I add the content length to the response the request styas open until the copy is finished?