How to set content length as long value in http header in java?

后端 未结 4 702
执念已碎
执念已碎 2021-01-01 22:48

I am writing a web server in java that is transferring file upto 2GB fine. When I searched for the reason, I found like java HttpServelet only allows us to set the content l

4条回答
  •  灰色年华
    2021-01-01 23:15

    Don't set it at all.

    Just let it use chunked transfer mode, which is the default. There is no Content-Length header in that circumstance. See @BalusC's comment under this question.

提交回复
热议问题