You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Chris Brown <ch...@hotmail.com> on 2004/11/17 14:36:38 UTC

Real-time feedback about upload progress

Hi all,

It's funny that I found myself helping out with real-time downloading 
feedback... I'm implementing it right now using HttpClient 3.0-alpha.  BUT, 
now I've stumbled across a problem...  The reverse, in fact!  I need to 
provide feedback on UPLOADING!

RequestEntity doesn't seem to provide me with any way to see how much of a 
stream has been sent to the server.  In InputStreamRequestEntity, for 
example, I can provide the input stream, and then execute the 
Post/PutMethod... and have control again when it's all done.

Am I right so far?  Is there no way to get feedback on how much data has 
been sent?

Assuming that you CAN'T get this feedback, I consider this an important 
feature to add for the 3.0 release (I'm not sure I can contribute anything 
more than an idea at the moment...).  Here's some ideas :

* modify RequestEntity so that can add a "Listener"-style interface for 
notifying some class each time one byte or a block of bytes has been 
transferred, something like

  RequestEntity::addRequestEntityMonitor(...)
  interface RequestEntityMonitor
  {
    void bytesTransferred(int numberOfBytes);
  }

* create some sort of FilterInputStream that can wrap any other InputStream, 
providing the above functionality.  This would be more light-weight than the 
above approach (no overhead for those that don't need this feature).

Can you confirm if I'm correct, and maybe let me know what you think of my 
suggestions (helpful comments only please!).

- Chris

_________________________________________________________________
MSN Hotmail : antivirus et antispam intégrés 
http://www.msn.fr/newhotmail/Default.asp?Ath=f


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: Real-time feedback about upload progress

Posted by Michael Becke <be...@u.washington.edu>.
Hi Chris,

You can also write you own RequestEntity that handles the progress 
inside of writeRequest(OutputStream). Looking at things from the 
writing end may be easier than wrapping an input stream.

Mike

On Nov 17, 2004, at 8:36 AM, Chris Brown wrote:

> Hi all,
>
> It's funny that I found myself helping out with real-time downloading 
> feedback... I'm implementing it right now using HttpClient 3.0-alpha.  
> BUT, now I've stumbled across a problem...  The reverse, in fact!  I 
> need to provide feedback on UPLOADING!
>
> RequestEntity doesn't seem to provide me with any way to see how much 
> of a stream has been sent to the server.  In InputStreamRequestEntity, 
> for example, I can provide the input stream, and then execute the 
> Post/PutMethod... and have control again when it's all done.
>
> Am I right so far?  Is there no way to get feedback on how much data 
> has been sent?
>
> Assuming that you CAN'T get this feedback, I consider this an 
> important feature to add for the 3.0 release (I'm not sure I can 
> contribute anything more than an idea at the moment...).  Here's some 
> ideas :
>
> * modify RequestEntity so that can add a "Listener"-style interface 
> for notifying some class each time one byte or a block of bytes has 
> been transferred, something like
>
>  RequestEntity::addRequestEntityMonitor(...)
>  interface RequestEntityMonitor
>  {
>    void bytesTransferred(int numberOfBytes);
>  }
>
> * create some sort of FilterInputStream that can wrap any other 
> InputStream, providing the above functionality.  This would be more 
> light-weight than the above approach (no overhead for those that don't 
> need this feature).
>
> Can you confirm if I'm correct, and maybe let me know what you think 
> of my suggestions (helpful comments only please!).
>
> - Chris
>
> _________________________________________________________________
> MSN Hotmail : antivirus et antispam intégrés 
> http://www.msn.fr/newhotmail/Default.asp?Ath=f
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: Real-time feedback about upload progress

Posted by Roland Weber <RO...@de.ibm.com>.
Hi Chris,

the FilterInputStream feels like the right approach to me.
Overriding the three read() methods shouldn't be too
tricky. The reset() method becomes interesting though.
But it's probably not used by HttpClient anyway, so no
problem for the intended scenario.

cheers,
  Roland




"Chris Brown" <ch...@hotmail.com> 
17.11.2004 14:36
Please respond to
"HttpClient Project"


To
httpclient-dev@jakarta.apache.org
cc

Subject
Real-time feedback about upload progress






Hi all,

It's funny that I found myself helping out with real-time downloading 
feedback... I'm implementing it right now using HttpClient 3.0-alpha. BUT, 

now I've stumbled across a problem...  The reverse, in fact!  I need to 
provide feedback on UPLOADING!

RequestEntity doesn't seem to provide me with any way to see how much of a 

stream has been sent to the server.  In InputStreamRequestEntity, for 
example, I can provide the input stream, and then execute the 
Post/PutMethod... and have control again when it's all done.

Am I right so far?  Is there no way to get feedback on how much data has 
been sent?

Assuming that you CAN'T get this feedback, I consider this an important 
feature to add for the 3.0 release (I'm not sure I can contribute anything 

more than an idea at the moment...).  Here's some ideas :

* modify RequestEntity so that can add a "Listener"-style interface for 
notifying some class each time one byte or a block of bytes has been 
transferred, something like

  RequestEntity::addRequestEntityMonitor(...)
  interface RequestEntityMonitor
  {
    void bytesTransferred(int numberOfBytes);
  }

* create some sort of FilterInputStream that can wrap any other 
InputStream, 
providing the above functionality.  This would be more light-weight than 
the 
above approach (no overhead for those that don't need this feature).

Can you confirm if I'm correct, and maybe let me know what you think of my 

suggestions (helpful comments only please!).

- Chris

_________________________________________________________________
MSN Hotmail : antivirus et antispam intégrés 
http://www.msn.fr/newhotmail/Default.asp?Ath=f


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org