You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by soapergem <so...@gmail.com> on 2008/11/01 19:59:57 UTC

Re: visualizing upload/download status in a statusbar

Hi,

I am very new to Java but have been trying to create a web applet that can
upload a file with a progress bar and requires no server-side Java to keep
track of how many bytes have been sent. Is this possible with this
"CountingRequestEntity" class? If so, could you please include some complete
example code of how this would be achieved? Also, you said that you are
unable to determine the total number of bytes that are being sent, but if
you have selected a File object representing the file to upload, can you not
just use File.length() to determine the total number of bytes? Thanks much.

Regards,

Gordon




Marcel Schiffel wrote:
> 
> Hi,
> 
> it's wrapped around another request entity, for example:
> 
> 		PostMethod method = new PostMethod(...);
> 		FileRequestEntity fre = new FileRequestEntity(someFile, "contentType");
> 		method.setRequestEntity(new CountingRequestEntity(fre, listener));
> 
> I've been able to use it with only minor changes (changed the type of the
> listener to ProgressHandle of the Netbeans Progress API). It's
> successfully counting the bytes sent, but I'm still not able to determine
> the total number of bytes that are sent, before executing the request. I'm
> therefore unable to tell the status bar what number of bytes is equivalent
> to 100%. Furthermore it is still not clear how to achieve the same thing
> when downloading a file (evaluating the response body stream).
> 

-- 
View this message in context: http://www.nabble.com/visualizing-upload-download-status-in-a-statusbar-tp19685137p20283364.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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