Is it possible to make an indicator of the process of downloading a file to the server (display the percentage of the downloaded file) without GET requests during the download (a very popular example on the Internet)?

    5 answers 5

    Take a look at the gwtupload library - it is very easy to use and works great in all browsers and OS I checked. She uses Ajax requests to calculate progress. By the way, SWFUpload does not work in Linux and Mac. So far this is the best solution for GWT.

      You can also use the comet, but it is quite painful, many problems with portability. But latency will be much better than several GETs.

      • You can write more. Particularly interesting is how to make such a load in Gwt. - Nicolas Chabanovsky
      • one
        Just as with many GETs, only one GET is done that does not end, and the data gradually comes. Those. you do not need to repeat GET or try to guess the frequency of calls to the server. The server itself can decide when and how much data to send to the client. Look in google about COMET. This technique is still gaining momentum and has its own problems, but there is a lot of information on it. - cy6erGn0m
      • Thank. I just assumed that the guys from Google have already done something in their library for this. - Nicolas Chabanovsky
      • code.google.com/p/rocket-gwt/wiki/Comet code.google.com/p/gwt-comet Itself dealt only with the first. - cy6erGn0m

      Well, many flash users - I most likely have something built in - not an expert - I will not speak. maybe there are some other libraries

      about the server - you get a post request. perhaps the packet size (file) will be indicated in the header - if the flow is parsing (at least I did this task on the Apache - there is a memory buffer on the server - 2 meters and the user uploads a 100 meter file - the muddy algorithm is very much attached to the web protocol, but can be made single pass). Well, in a similar algorithm, you can always understand how much you have saved from the client. if we take from the value specified in the header the size already received - and save the value to some memcache - then with a periodic second request from the client you can receive and display information about the load.

      To do it by hand is possible but too long and dreary. perhaps some web servers automatically provide the necessary functionality - for example, some callbacks when reading the next 2 megabytes from the client

      I did it on c. but in Java (in the servlet) it is also possible to get the stream and parse it yourself.

        I advise you to see how GMail works when attaching a file to a letter. Requests sent can be viewed using the Fire Bug.

          without queries - no way))) only very roughly, and then a couple will have to be made to make them just rare, or rather, frequent at the beginning, consider speed, and then specify as rare requests

          although it may be pulled out of the browser. but I have not seen any examples. I think it's easier to throw 5 get

          • @ uramer239 Instead of creating a new answer, correctly edit your previous one. - Nicolas Chabanovsky
          • one
            OK, I 'll keep in mind - uramer239