Hi Mike, Yes but i think that with the Response body only i can't know "How many bytes is downloaded already?". My question, Is possible to built-in this feature in the future? or is imposible due to HttpClient use only Java Sync IO?. I think that with the "New IO" we can calculate more easy the bytes downloaded already. is right?
thanks, Gaspar ----- Original Message ----- From: "Michael Becke" <[EMAIL PROTECTED]> To: "HttpClient Project" <[EMAIL PROTECTED]> Sent: Monday, November 15, 2004 8:06 PM Subject: Re: How i can get information about the downloading process? Hi Gaspar, HttpClient does not support timing directly. There is no built-in way to get status on the request progress. As Chris has described the only real timing that can be done is with the response body. Mike On Nov 15, 2004, at 11:14 PM, Gaspar wrote: > Hi Chris, > > First of all, thanks for your explanation, but maybe i don't explain > very > well what is my problem. Yes i know that this is the way to obtain this > information, but how you can did the algorithm that you describe if > the code > line (see below the number 1) don't return until it finish the download > process completely. do you understand now my doubt?. Maybe using > multithreading i can resolve this problem, but can i only resolve it > using > multithreading only? > > thanks in advance, > Gaspar > > Here is the code, see the line 1), is what i use to download the file. > ... > > HttpMethod method = new GetMethod(getURL().toString()); > > ... > > // start the download process > line 1) statusCode = client.executeMethod(method); > ----- Original Message ----- > From: "Chris Brown" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, November 07, 2004 1:00 AM > Subject: RE: How i can get information about the downloading process? > > >> Hi Gaspar, >> >> If you use some of the approaches that let HTTPClient do all the hard >> work >> for you, you'll not have this feedback as far as I'm aware. >> >> But it's quite simple to get this information yourself. If you open >> the >> connection and read data as a stream, you need to remember : >> >> * the time (e.g. System.currentTimeMillis()) you started as a "long" >> variable >> >> * the total number of bytes so far read as a "long" variable, updated >> each >> time you read some bytes from the stream >> >> * you can determine the average speed so far by dividing the number of > bytes >> downloaded by the time taken so far (see both points above); that's >> not >> necessarily your current speed >> >> * for the percentage remaining, you'll need to know in advance the >> size of >> what you're going to download (the HTTP response header >> "Content-Length" >> should help here, but you're not always going to get this >> information, and >> it's not always provided correctly by the server). >> >> You'll want multithreading no doubt, so make your "download" object >> expose > >> this information through "getter" methods. You can then display this >> on > the >> command line, in a progress bar, or whatever. >> >> - Chris >> >> >>> From: "Gaspar" <[EMAIL PROTECTED]> >>> Reply-To: "HttpClient Project" <[EMAIL PROTECTED]> >>> To: <[EMAIL PROTECTED]> >>> Subject: How i can get information about the downloading process? >>> Date: Sat, 6 Nov 2004 16:08:35 -0800 >>> >>> Hi, >>> >>> My question is about how i can do with HttpClient, something that i >>> see > on >>> many download manager software. >>> >>> About the file that i'm downloading using HttpClient i want to get >>> this >>> information: >>> >>> - % of the file that is downloaded already. >>> - the size of what is downloaded already. >>> - the speed rate(b/s) of what is downloading. >>> - the time left to finish the download process. >>> >>> the downlaod manager that i use is ReGet Deluxe 3.3 and i want do > something >>> similar with HttpClient. >>> >>> Thanks in advance, >>> Gaspar >>> >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: >>> [EMAIL PROTECTED] >>> >> >> _________________________________________________________________ >> MSN Actions Solidaires : volontaire � l'�tranger >> http://www.msn.fr/actionssolidaires/Default.asp?Ath=f >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: >> [EMAIL PROTECTED] >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
