I have written a servlet that will return a csv file (dynamically generated) to the user to download. However the client is not able to see the file size which means they receive no progress indicator.
I have this code
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { String csv = getCsv(); resp.setContentType("text/csv"); resp.setContentLength(csv.getBytes().length); resp.getWriter().write(csv); } catch (Exception e) { log.error("error generating feed", e); } } thank you.