hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: progress bar for MultipartFileUploadApp
Date Sun, 27 Feb 2005 18:28:52 GMT
Tom,

MultipartPostMethod class has been deprecated in favor of PostMethod and
MultipartRequestEntity. The 3.0 sample code can be found here
<http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/httpclient/trunk/src/examples/MultipartFileUploadApp.java?view=markup>


In order to implement a progress monitor you'll have to subclass the
MultipartRequestEntity and override the writeRequest method.
MultipartRequestEntity can compute the total length of the payload to be
uploaded. Every time a chunk of data is written to the OutputStream you
should fire an event containing the total number of bytes written so
far. In your application you should register an event listener with the
custom MultipartRequestEntity class. Knowing the total number of bytes
and receiving notifications about chunks of data being written to the
output stream should be sufficient to implement a progress indicator
using GUI primitives of your choice.

Rewriting MultipartRequestEntity#writeRequest won't be easy, but should
be doable if you are prepared to spend some time studying HttpClient
source code.

Hope this clarifies things a little

Oleg


On Sun, 2005-02-27 at 09:49 -0800, Tom Rich wrote: 
> Oleg:
> Thank you for your Email.  Could you please give me more details about it?
>  
> The example uses MultipartPostMethod. All methods in that class are deprecated. I do
not know what is the cureent version of that class. 
>  
> Thank
> 
> tom
> 
> Oleg Kalnichevski <olegk@apache.org> wrote:
> Tom,
> 
> What version of HttpClient are you using? If you are using HttpClient
> 3.0, you best option is to subclass the MultipartRequestEntity and to
> build an event based notification mechanism on top of it.
> 
> Hope this helps
> 
> Oleg
> 
> On Sat, 2005-02-26 at 14:18 -0800, Tom Rich wrote:
> > Hi, I am new to httpclient and testing the MultipartFileUploadApp. How can I monitor
the progress of the upload and report the status to a progress bar, for example?
> > 
> > Thanks,
> > 
> > autogoor
> > 
> > 
> > 
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! Mail - now with 250MB free storage. Learn more.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 
> 
> 		
> ---------------------------------
> Do you Yahoo!?
>  Read only the mail you want - Yahoo! Mail SpamGuard.


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


Mime
View raw message