Java – is there a limit on the size of the response I can read over HTTP

I have a java program that calls a URL The response to the URL is JSON / string I have to write a program to get data from this URL, but I want to know if there is a limit on the maximum size that HTTP can return?

I intend to write my server-side (URL) in this way. It gets all the data from DB, but if the size I can get from the server is limited, can I still read in batches?

So, is there a limit on the response size that I can send from the server to my java program over HTTP?

In addition, I met this link The last reply said that the size equals int, and I'm not sure what that means If anyone can explain

thank you

Solution

There is no technical limit on the size of the HTTP body

In the link you refer to, it seems to be a restriction imposed by the specific object parsing HTTP, because the object uses int as the size, which is of course possible, but independent of the HTTP protocol

In HTTP, you must always provide the other party with the content length (both for request and response). If your response is very large, the client will process it in an acceptable way (such as direct streaming to the file back end)

Chunking is good, but it only applies to you (the person who sends a large response) who doesn't know the actual total size of your response before you stream it If you know the size beforehand, use the content length header

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>