Hello, everyone. I have a problem.
update: in fact, outputstream.write
is an additional operation, not a rewrite. For example, after the first write
and flush
, flush can also be pushed to the client, and it is appended. My problem is that the subsequent appended operations are not written to the excel generated for the first time. In Explorer, you can see that the file size is 28kb, and when it is opened and then closed, it becomes 8kb.
original question:
if the client wants to download the excel file, I find it in the database, then use apache poi to generate the byte array, to set the response header, and then send it back to the client, and the client can download it.
The problem withis that sometimes it takes a long time to generate this excel, and the browser times out when it doesn"t receive a response. I wondered if I could generate a part and send a part so that the connection was established. Until all the content is generated, then close the connection.
I used servlet.getOutputStream ()
, and did not find a method similar to append. The PrinterWriter
class has a similar method, but I tried it. If it is sent back to the client, it cannot be opened, so it can only be sent back in binary, right? I also tried socket
, but I also needed the method socket.getOutputStream ();
to get the output stream, which came back.
so come here to ask you, is there any other way to achieve my need, or is this requirement unachievable? If there is a better way, please let me know. Thank you!