What i am searching to do is download file in response of get request and redirect to an other get request
DataOutputStream dos = new DataOutputStream(request.getResponseStream());
HttpServletRequest httpServletRequest = request.getHttpRequest();
if(request.isFile()){
JAXBContext newInstance = JAXBContext.newInstance(GetCoverageType.class);
Marshaller marshaller = newInstance.createMarshaller();
marshaller.marshal(responseData.getCoverage(), dos);
} else {
response.setContentType("application/netcdf");
response.setHeader("Location", httpServletRequest.getRequestUrl() + "?" + httpServletRequest.getQueryString() + "&isFile=true");
File file = new File(responseData.getLocation());
response.addHeader("ContentDisposition", "attachment; filename=test");
response.setContentType("application/netcdf");
Files.copy(file, dos);
//response.sendRedirect(httpServletRequest.getRequestUrl() + "?" + httpServletRequest.getQueryString() + "&isFile=true")
}
I did something like this but the location header does not send an other request on browser if my status code is 200. Moreover, I could not find a way to download my file and then redirect to my xml