This discussion is archived
4 Replies Latest reply: Oct 10, 2008 12:29 PM by DarrylBurke RSS

impossible to send back a CSV file containing more than 8000 chars

807589 Newbie
Currently Being Moderated
Hello,
I work on an application using Spring and I try to write a String of around 19000 chars in a CSV file that I send back to the client with the method PrintWriter.write (response.getWriter().write) of the object HttpServletResponse. Here is the code :
public ModelAndView getViewdomainReport(HttpServletRequest request, HttpServletResponse response) throws Exception {
// domainString is a string containing around 19000 chars
String domainString = reportManagementService.getViewdomainReport(domainRows,domain);
String filename = domain.getDomainNameWithoutBlank()+".csv";
response.setContentType("text/csv");
response.getWriter().write(domainString);
response.setHeader("Content-Disposition", "attachment; filename=\""
                   + filename + "\"");
 return null;
}
 
The following thing is strange : when the String domainString has less than 8000 chars, the file CSV is sent back to the client with the appropriate name and I can open it with EXCEL. When I exceed 8000 chars, I cannot get the response with a CSV format, but the response is directly sent to the browser as a String (domainString) printed directly in the browser page with the URL /getViewdomainReport.htm. That is I exceed the capacity of a sent file with the method write. I think that the fact that it is sent in a CSV format has no importance. It would be the same with a html format or else. It is surely the size of the response which is limited. What can I do ? is it a buffer matter ? how can I get my 19000 chars in my CSV file so I can open it with EXCELL ?
If you can help me, thank you in advance