I have a java program, that calls a url. The response of url is a json/string. I have to write a program that fetches the data from this url, but I was wondering if there\'s a l
you can consume the response in chunks i.e if the response is 8 mb you can consume 1mb at a time
here is the example http://mrbool.com/keep-alive-connections-and-chunked-response-in-http-1-1-with-java/27915
There is no technical limit to the size of a HTTP body.
In the link you refer to it seems a limit imposed by a specific object that parses the HTTP because the object uses an int for the size, this is of course possible but not related to the HTTP protocol.
In HTTP you always have to give a content-length to the other side (is both for request & response), if your response is really large, it is up to the client to process it in an acceptable way (e.g. stream it directly to a file backend).
Chunking is nice but it is only meant for when you (the one sending the large response) don't know the actual total size of your response until you have streamed it. If you know the size beforehand, use the content-length header.