COS has an unpleasant license (I have no interest in buying a servlets book), and Jason Hunter has done horrible things to the servlet spec so I'm not a big fan.

I must admit, I didn't think of commons fileupload, I'll investigate since I think they might already have this functionality.

On Dec 23, 2003, at 9:02 AM, Frank Febbraro wrote:

The Listener sounds like a great idea.

However since the pell code/developer sounds like it does not accept changes
too easily, has inefficiencies, and would require even more maintainence
just to add new functionality, could something like this be added to COS or
Apache Commons FileUpload instead? Maybe they would be more interested in
incorporating this functionality?


Otherwise, thanks, I look forward to this fucntionality.

----- Original Message -----
From: "Hani Suleiman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 21, 2003 1:44 AM
Subject: [OS-webwork] File upload progressbar


I've been piddling about with the idea of a progress monitor for file
uploads. At least 4 people have asked for it so it might be a
worthwhile addition to ww 1.4 (and then ported to 2.0).

I have something working now, I'll explain how it works below and would
appreciate any feedback as I'd rather people sign off on it before/if I
commit it.


The first issue is that it requires changes to the pell multipart
library. There's no cvs tree for this so maintaining diffs would be too
annoying, so we have a couple of options:


1) Move the code to the webwork tree, which would have the advantage of
being able to clean up the pell code (it's very, VERY ugly and quite
inefficient in some places), but the disadvantage would be that it's
extra code for us to maintain.


2) Publish a set of diffs against the latest version of pell, so anyone
updating pell can apply diffs and check in the resultant binary.
Advantages is that we'd stay kinda in sync with pell. Disadvantages
would be the hassle of managing the diffs.


3) Get Jason Pell to accept the changes and commit them to his tree.
I've emailed him about the changes I made a year ago, but he didn't
seem that interested, might be worth trying again.

The actual changes are the addition of a MultipartListener interface
which is passed in to the various constructors, this has 3 methods:

   void fileStarted(String fileName, long size);
   void dataRead(String fileName, int amount);
   void fileCompleted(String fileName);

It's fairly clear from the names what each one does.

Modifications in webwork:

Addition of a ProgessMonitor bean, this would hold the current 'state'
of the upload. Currently I have it implemented with filename/data left
to read/data read/total size.

Modification of PellMultiPartRequest to implement MultipartListener,
and pass itself into the pell constructors. Before the pell constructor
is called, an instance of the progress meter is created and put in the
http session (it's also a new field in PellMultipartRequest). The
implementation of the listener methods simply updates the appropriate
fields in the progress bean. When the pell constructor returns (ie,
parsing is done), the progress bean is removed from the session.


That's pretty much it on the server end. So during the upload, there is
a progress bean in the session that can be queried on the client side.


The modification I made to the webwork upload example is to add an
iframe to the upload page. When the page is loaded, the iframe is set
to be blank, when the form is submitted, the iframe location is set to
a simple jsp page that just reads the properties of the progress bean
and displays them.

So...thoughts?

Hani



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork





------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to