When the file size is less than 8k, the file name display correctly,
When more than 8k, can not display, after modify the file suffix, open the file, the data is output completely.How to do
OutputStream fileoutStream = response.getOutputStream();
String filename = new String(wbname.getBytes(), "ISO-8859-1");
You need to add the headers before writing to the
OutputStream. It works when the file is small enough because the output is buffered, but technically I think that's a bug. The HTTP protocol requires that all the headers are sent to the client first, and then the payload. You can't go back and add headers once the first byte of the payload is flushed to the socket.