I don't see how the upload wouldn't block the request thread.  You'd need to have another thread running to return the status to the user, and I'm not sure that possible, or even advisable. 

On 11/24/05, Andrew Lombardi <[EMAIL PROTECTED]> wrote:
johan,

ok, i've attempted that, and ran into the same blocking-type behaviour.  I've added the following to the init() of my Application:

        DynamicByteArrayResource dbar = new DynamicByteArrayResource() {
            protected byte[] getData() {
                if(RequestCycle.get()!=null) {
                ProgressSession sess = (ProgressSession) RequestCycle.get().getSession();
                if(sess!=null) {
                    int count = sess.getCount();
                    String countStatus = "count: "+count;
                    return countStatus.getBytes();
                }
                }
                return "".getBytes();
            }

            public String getContentType() {
                return "text/html";
            }
        };

        Application.get().getSharedResources().add("statusResource", dbar);


ProgressSession being a Session implementation holding property count.

And then in a Page component, I've grabbed a ResourceReference and printed out the accessor url with this:

        ResourceReference ref = new ResourceReference( "statusResource");

        String url = "">
        System.out.println("url:"+url);


And the resource gets pulled up fine without the upload occuring at the same time.  but once the upload occurs, it seems to exhibit a blocking behaviour.

any ideas?  it shouldn't behave this way right?  i'm using 1.1 final.

-kin


On Nov 23, 2005, at 3:02 PM, Johan Compagner wrote:

just an idea.
The progress bar thread could be a SharedResource request.
Those request are not synchonized.
And you can give back the progress number everytime the Resource is requested.

johan


On 11/23/05, Andrew Lombardi < [EMAIL PROTECTED]> wrote:
I've got a need to show an Upload progress bar in a Wicket app that
I've built.  We're uploading some fairly large files and would like
to see some statuses.  Figured out with Igor how to go about
injecting a CountingInputStream into the process for FileUpload, but
have run into a roadblock!

What ends up happening, is the page runs a _javascript_, to show
another page that meta refreshes and shows a status grabbed from the
session.  And at the same time submits the form to start the upload.
Only problem is, it seems to block on the form submission  uploading
the file, and never shows the status page until after its done
processing the form.  Obviously too late.

Igor mentioned that this was probably because Wicket synchronizes
with the session.  And we both think there must be a way around this
that is missing.

the code I have overrides:

protected WebRequest newWebRequest(HttpServletRequest servletRequest)

and then subclasses ServletWebRequest offering a wrapped
MultipartServletWebRequest which passes back a custom FileItem that
wraps the InputStream in a CountingInputStream, that in turn updates
the Session.  Whew!  That was long.

Ideas and thoughts?

Thanks!



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



Reply via email to