« Return to Thread: broken examples

broken examples

by Leonardo-31 :: Rate this Message:

Reply to Author | View in Thread

http://directwebremoting.org/dwr/examples/index.html
all example links returned rerror, :(

2009/6/3 Lance Java <lance.java@...>
I've been doing a fair bit of work on out of the box dwr support for file upload progress and cancel but wanted to run the new API past the user's list to get some feedback.

The basic approach is this:

<javascript>
dwr.engine.setUploadProgressPollInterval(...);
Remote.uploadFile(
   dwr.util.byId("myFile"),
   callback: ...,
   progressCallback: function(percentageComplete) {
      updateSomeWidget(percentageComplete);
   },
   id: "myUpload" // this allows a developer to provide a handle for the upload, dwr generates it's own invocationId to use internally
);

dwr.engine.cancelUpload("myUpload");
</javascript>

engine.js generates an invocationId which is passed to the server which can be used to cancel an upload or poll it's current progress.

On the serverside there is a (pluggable) UploadManager with the following interface:

public interface UploadManager {
    public void updateProgress(String invocationId, long bytesRead, long contentLength, int currentItemIndex);
    public double getPercentageComplete(String invocationId);
    public void cancelUpload(String invocationId);
}

I have implemented 2 upload managers. 1 stores on the session (similar to the current approach). Another (default) stores to a local map.

There is also a (pluggable) FileUpload (default CommonsFileUpload) that is capable of parsing a multipart request and informing the UploadManager of the current progress for the invocationId.

So... my main questions to the group are:

1. How many people use the current file upload progress implementation (storing on session)
2. Does anyone currently support cancel of a file upload
3. Do we agree on the UploadManager approach (you'll need a good argument here!)
4. Does anyone have arguments for better naming conventions
  a) dwr.engine.setUploadProgressPollInterval(...)
  b) progressCallback: function(percentageComplete) { ... }
  c) id: "myUpload"
  d) dwr.engine.cancelUpload("myUpload");
  e) invocationId
5. Any other suggestions / improvements?

Cheers,
Lance.




 « Return to Thread: broken examples