Using ServletOutputStream to write very large files in a Java servlet without memory issues

后端 未结 10 1735
太阳男子
太阳男子 2020-12-01 00:28

I am using IBM Websphere Application Server v6 and Java 1.4 and am trying to write large CSV files to the ServletOutputStream for a user to download. Files are

10条回答
  •  悲&欢浪女
    2020-12-01 00:44

    1. Kevin's class should close the m_out field if it's not null in the close() operator, we don't want to leak things, do we?

    2. As well as the ServletOutputStream.flush() operator, the HttpServletResponse.flushBuffer() operation may also flush the buffers. However, it appears to be an implementation specific detail as to whether or not these operations have any effect, or whether http content length support is interfering. Remember, specifying content-length is an option on HTTP 1.0, so things should just stream out if you flush things. But I don't see that

提交回复
热议问题