[prev in list] [next in list] [prev in thread] [next in thread]
List: httpclient-users
Subject: Re: HttpContentTooLargeException??
From: "stephen joseph butler" <stephen.butler () gmail ! com>
Date: 2008-02-22 18:30:36
Message-ID: f107df20802221030w70b7257fi32c819907f419342 () mail ! gmail ! com
[Download RAW message or body]
On Fri, Feb 22, 2008 at 11:27 AM, Mike J. M. <mikemyers@gmail.com> wrote:
> I just spotted this in the docs, and I was wondering how to use this class.
> Is it even being used by any current classes? I want to limit the size of a
> download either before or during downloading. My code right now simply
> downloads the whole file and THEN check the size. But that wouldn't work
> right because if someone tries to download a file that's 100 MB then it'll
> download the whole 100 MB, or timeout, whichever comes first, and then check
> the size.
> What's the smart way to limit file download sizes, or maybe in this case
> response body sizes in HttpClient?
I guess you want commons-io ThresholdingOutputStream:
<http://commons.apache.org/io/api-release/org/apache/commons/io/output/ThresholdingOutputStream.html>
Then use IOUtils.copy(InputStream,OutputStream) to read the data from
method.getResponseBodyAsStream().
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic