Some time ago Aaron Porter sent a sample code demonstrating how to add support for any event of any action to be able to show interim page if action takes more than preconfigured time.
I started with sample code and it did work for most the cases. However, I got side tracked, so I never finished the whole evaluation - it is still on my back burner. I am not sure if it also would work for file uploads, but it might worth a shot. The thread title is 'actions that take long time' in case original attachment does not go through. Leonard -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Zenin, Ruslan Sent: Monday, April 21, 2008 7:40 AM To: [email protected] Subject: [Stripes-users] FileUpload any events available during upload? Hello all, Is there any callback events available for Stripes file upload? I'd like to show a progress of the large uploads (big files that are uploaded via slow connection). I've seen some websites that show pretty nice upload progress via AJAX div tag... In Stripes, FileBean becomes available only when upload is finished...therefore if file takes 5 min to upload...I'd not have a chance to provide user in the browser with the progress of the upload (e.g.% uploaded so far, estimated time to finish upload, avg. speed, etc.) Perhaps I'm missing something and callback events for file upload already exists...or may be there is another way... Any ideas/suggestions? Best regards, Ruslan ************************************************************************ *************************** The information in this email is confidential and may be legally privileged. Access to this email by anyone other than the intended addressee is unauthorized. If you are not the intended recipient of this message, any review, disclosure, copying, distribution, retention, or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. If you are not the intended recipient, please reply to or forward a copy of this message to the sender and delete the message, any attachments, and any copies thereof from your system. ************************************************************************ *************************** ------------------------------------------------------------------------ - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/j avaone _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
--- Begin Message ---I've rewritten most of WaitPageInterceptor and am happy with it now. You can see a demo of it here: http://www.mongus.com/WaitPageInterceptor/ The source is available via SVN here: https://mongus.com/svn/source/WaitPageInterceptor/ It now makes a real request to the server in the separate thread instead of just executing the event handler. The session is maintained in the new thread's request so login info, etc. will be valid. You should be able to just add the annotation and a wait page to make it work. If you want you can do a little more work inside of your ActionBean to allow progress information to be displayed within the wait page. Examples are included. Aaron Leonard Gestrin wrote: > This is pretty cool! I have not used stripes interceptors up close and > personal (I used SpringBeanInterceptor without too much thinking what's > going behind the scene), but it is such a power tool bundled with > annotations. > > Given code is definitely doing 99% of work - thank you for your time. > > There couple issues that still needs to be resolved (I am not sure if it > is better to take off line or keep the thread going, but I'll keep it > going - its been quite day today) > > WaitPageInterceptor > > 1. line 35 - LifecycleStage.RequestInit - it appears it's 1.5 feature; I > bounded it to LifecycleStage.ActionBeanResolution in 1.4 > > 2. line 120 - > // redirect to the wait page and add the processor id as a parameter > return new > RedirectResolution(StripesFilter.getConfiguration().getActionResolver(). > getUrlBinding(processor.actionBean.getClass())) > > I think it needs to be changed to something like this (since current > implementation is going to URL that is bound to original action as > oppose to wait page) > // redirect to the wait page and add the processor id as a parameter > return new > RedirectResolution(annotation.path()) > > .addParameter(THREAD_PARAMETER, Integer.toHexString(processorId)); > > It might make sense to keep another class member > Processor.waitResolution, which has to be RedirectResolution in case we > want to add parameter with process id. > > Displaying progress indicator should probably be done on ActionBean > itself since it's specific functionality to a bean and can not be > generalized via Annotation or interceptor. (on every reload check if > actionBean in process implements Progressable, and call > Progressable.getProgress(). > > > All of these comments are minor but I am very impressed by the ability > of weaving such feature with practically no changes (except annotation) > to existing action beans. > > Thank you > > P.S. I'll post final version of this functionality once I get it working > all the way, if interested. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Aaron > Porter > Sent: Thursday, January 24, 2008 9:32 PM > To: [email protected] > Subject: Re: [Stripes-users] actions that take long time > > Witness the power of Stripes! :D > > http://www.mongus.com/stripes/WaitPageInterceptor.java > http://www.mongus.com/stripes/WaitPage.java > > This is the first run at a wait page handler. Make sure you load the > interceptor then all you have > to do is > > @WaitPage(path="/waitpage.jsp") > public Resolution myEvent() > { > // your code here > } > > your wait page will be displayed while myEvent executes. > > Make sure your wait page reloads itself. you can do this with JavaScript > or you can add > <meta http-equiv="refresh" content="1" /> > to your HTML. It is set up so that you can report the progress by > setting a field in your actionBean > during event handling then displaying the progress in the wait page. > Just make sure you add a > parameter named ajax otherwise the wait page won't keep reloading, it > will just sit there waiting > for 60 seconds or the event handler to complete, whichever comes first. > > The annotation also accepts a delay parameter which is the number of > milliseconds to give your event > handler to run before going to the wait page. The error parameter is the > jsp that will be forwarded > to in event of an error that makes it all the way out. Both the wait > page and the error page receive > the actionBean as a request attribute so you can do whatever you want > there. The error page also > receives the exception encountered as a request attribute. > > Here's an example event handler: > > @WaitPage(path="/wait.jsp",delay=500,error="/error.jsp") > public Resolution test() throws InterruptedException > { > Thread.sleep(5000); > > return new RedirectResolution("/complete.jsp"); > } > > Enjoy! I'm going to bed. :) > > Aaron > > Aaron Porter wrote: > >> I'm actually working on an Interceptor to do it right now. I can add >> > in a delay that would wait x > >> seconds for the event to complete before forwarding on to the wait >> > page. I might have the initial > >> code done tonight but no promises. :) >> >> Aaron >> >> > > > ------------------------------------------------------------------------ > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Stripes-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/stripes-users > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Stripes-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/stripes-users > > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
--- End Message ---
------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
