79786328

Date: 2025-10-09 11:21:00
Score: 0.5
Natty:
Report link

What i understood is ur app becomes slow because it is waiting for the whole file to load and then it shows you the save as dialog box.
So ur UI feels like blocked or stuck ....So if this is the problem then , Instead of using Angular httpclient to fetch the file, you must let the browser to handle the download directly.

public void download(....){

// dont return Response Entity<ByteArrayResource> ....
instead

response.setContentType("text/csv");
response.setHeader( your header);

response.setContentLength(butes.length);

ServletOutputStream os = response.getOutputStream();

os.write();

os.flush()

os.close();

/*Pls. check the code before use ... just giving you an idea*/

// this approach streams the bytes directly to the HTTP response and browser confuses with the input type and transfer the control on client side that "what you want my boss"

}

and make some changes in front end side too

because you r using

this.http.get(url,{

// some code

})
mand
if(event.type== ..response){

saveAs(...)

}
means first download the file / load the file and then use ..only then after u would able to do save as

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Starts with a question (0.5): What i
  • Low reputation (0.5):
Posted by: Ashish Bansal