I am attempting to prevent org.apache.http.client.HttpClient (link text) from installing your body once the resource let us say over 10 Megabytes.
Things I did after searching here, yet others is perform a Mind call, then look into the Content-Length header, and when it's < 10MB, perform a GET call, finally make a move using the response body.
Would there be considered a better means to fix this? I wish to avoid an additional call.
You could perform a regular call and appearance the space, and when the space > 10MB then just break and cancel the download. But however , socket will still download whenever possible before you decide to cancel. I believe carrying out a Mind call is the greatest method.
The easiest way is certainly to complete the HTTP Mind since Mind request only header info on file or resource (as stipulated on RFC1945, Section 8.2).
In the response from the Mind call, retrieve the
Content-Length message header if the dimensions are under or more than 10MB.
Carrying out a GET can lead to coming back the entire entity body.
Apache HttpClient (Version 3) supports HTTP Mind.