wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elliotk <elliot.kha...@gmail.com>
Subject UploadInfo subject in session
Date Fri, 01 Feb 2008 19:40:58 GMT

Requirement: The user can upload only one file at a time.
The use case is this. A user wants to upload a file. They hit an upload
button and upload progress bar appears. The user gets bored and decides to
do something else while upload is going on. So they open another instance.
They decide to upload  another file (watching the previous upload). They try
to upload another file, application doesn't let them and let's them know
another upload is in progress. 
I tried to use UploadProgressBar for this purpose. 
At first I did exactly what the example showed, that is wrap all the
requests into UploadWebRequest on application level and set the form to
multiPart=true. That didn't work, and my progress bar would not update. The
only thing i didn't do was i didn't mount my pages. So the page that is
doing the upload is not a bookmarkable page. Is it a requirement for it? 
Anyway, i decided to help the upload out a little bit and create my own
instance of uploadinfo and put that in session when uploaded started and
when upload finished. I also updated it during the file upload
appropriately. It worked fine. Until I tried to launch another web page and
try to upload. It broke the current upload because it was competing for the
uploadinfo obj in session. I figured it was because uploadinfo was keyed on
UploadWebRequest.class.getName() - therefore not unique key. So I tried to
work around it by creating a unique key (UploadWebRequest.class.getName() +
pagePapName()) or just a name of a different class
(MyUniquePage.class.getName()). That didn't work. 
More over I tried creating a synchronized block of code that would only
set/get uploadinfo session variable in them, therefore restricting access to
the waiting threads. All without lock. I settled down (for now) with
creating my own session object, that informs user is there is an upload in
progress. As far as upload progress, i think i will create an ajax component
that will pull the status of the upload. Let me know if i am completely
offline. Thanks.
View this message in context: http://www.nabble.com/UploadInfo-subject-in-session-tp15231990p15231990.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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

View raw message