There is alreay ProgressInputStream http://josm.openstreetmap.de/browser/trunk/src/org/openstreetmap/josm/io/ProgressInputStream.java in the JOSM code base and a "ProgressOutputStream" could be built easily.
But again, I don't think this would help much. If we really wanted to display progress information, we would need a kind of streaming reply from the server, as proposed by others on this thread. Regards Karl -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von Ævar Arnfjörð Bjarmason Gesendet: Donnerstag, 10. Dezember 2009 18:09 An: Peter Körner Cc: [email protected] Betreff: Re: [OSM-dev] Structured error messages from API On Thu, Dec 10, 2009 at 17:01, Peter Körner <[email protected]> wrote: >> You mean showing upload progress in JOSM as opposed to the current >> cylon impression? That could be implemented by counting the number of >> bytes of the osmChange request that have been successfully sent over >> the wire. That's how upload progress bars are usually implemented. >> >> Obviously the upload could fail but that's another issue. > > That looks somehow more intelligent than streaming the progress from > the server back to the client. It is:) When I upload a file with Google Chrome it always shows the progress of the upload. This isn't done with some ad-hoc streaming XML from the server, the client is just counting how many bytes it has sent over the wire and how large a percentage that is of the total. I looked at the relevant code in JOSM once but I couldn't find a way to do it (but I'm not familiar with Java). In Perl with HTTP::Request::Common you can do e.g.: $HTTP::Request::Common::DYNAMIC_FILE_UPLOAD = 1 my $req = HTTP::Request::Common->new( ... ); $req->content( sub { my $chunk = &$gen(); my $length = length $chunk; warn "I'm now uploading a chunk of length $length, of a total of $total bytes"; return $chunk; } ); my $result = LWP::UserAgent->request( $req ); (See this code for a practical example of this that I wrote: http://cpansearch.perl.org/src/CPB/Flickr-Upload-1.32/Upload.pm) I presume Java has some library to do this as well but I couldn't find it. _______________________________________________ dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/dev _______________________________________________ dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/dev

