one solution might be to pull document from a mounted resource: which are not locked.
On Thu, Apr 10, 2014 at 6:16 PM, Jesse Long <j...@unknown.za.net> wrote: > On 10/04/2014 12:53, Martin Grigorov wrote: > >> On Thu, Apr 10, 2014 at 1:44 PM, Ernesto Reinaldo Barreiro < >> reier...@gmail.com> wrote: >> >> Hi, >>> >>> >>> On Thu, Apr 10, 2014 at 12:36 PM, Tobias Gierke < >>> tobias.gie...@voipfuture.com> wrote: >>> >>> Hi, >>>> >>>> Hi, >>>> >>>>> >>>>> >>>>> On Thu, Apr 10, 2014 at 1:13 PM, Tobias Gierke < >>>>> tobias.gie...@voipfuture.com >>>>> >>>>> wrote: >>>>>> Hi, >>>>>> >>>>>> What do you exactly mean by the rendering of the page after >>>>>> download >>>>>> >>>>>> completed? You repaint a part of the screen via AJAX? And this is the >>>>>>> one >>>>>>> giving problem with images? >>>>>>> >>>>>>> Good point. I just investigated the AJAX response returned by the >>>>>>> >>>>>> server >>>>>> when clicking the 'Start download' button on the modal dialog and I >>>>>> noticed >>>>>> that along with the JavaScript snippet that does the "setTimeout(...)" >>>>>> there are also a lot of AJAX component updates that are obviously >>>>>> generated >>>>>> by components with overridden onEvent() methods. I didn't write the >>>>>> >>>>> code >>> >>>> so >>>>>> I wasn't aware of this :/ >>>>>> >>>>>> I suspect that the issue I'm seeing is caused by the Wicket AJAX >>>>>> >>>>> library >>> >>>> being interrupted by the "setTimeout()" call while processing the >>>>>> component >>>>>> updates... proving this will unfortunately take some time since the >>>>>> >>>>> page >>> >>>> has a lot of different components that all override onEvent() ... >>>>>> >>>>>> JavaScript is single-threaded. There is no way to interrupt it. >>>>>> >>>>> By using setTimeout/setInterval functions you just add tasks to the >>>>> >>>> queue >>> >>>> that this single thread processes. >>>>> >>>>> I stand corrected ;) But how come - given that setTimeout() just >>>> adds a >>>> task to some "queue" - the actual magnitude of the timeout has an effect >>>> >>> ? >>> >>>> My queues are usually processed first-to-last ;) >>>> >>>> Probably the time out just influence the download of images: e.g. >>> maybe by >>> making >>> >>> window.location.href='" + url + "'\", 100); >>> >>> You are telling the browser "stop loading images, we are processing anew >>> document" >>> >>> There is still something unclear here - window.location.href is >> contributed >> via target.appendJavaScript(). >> This means it is put into <evaluate> XML element in the Ajax response and >> should be processed (sequentially!) later than the resource downloads by >> Wicket.FunctionExecuter. I.e. the resources should fire their "loaded" >> events before FunctionExecuter to move to the next task >> >> >> > Page locking maybe? Does the download lock the page for the duration of > the download? > > ajax get > ajax response > dom modified > browser starts downloading images in background, one (or a few) at a time > download of file starts (page is locked on server) > while file download is still busy, browser attempts to download other > images. This may require page lock on server, which will make this request > hang until file download is complete. > > Maybe, instead of using AJAXDownload, make like: > > new AjaxLink("link"){ > @Override > public void onClick(AjaxRequestTarget target){ > // do whatever > target.add(...); > > Application.get().getResourceReferenceRegistry() > .registerResourceReference(MyDownloadResourceReference.INSTANCE); > > target.appendJavaScript("setTimeout(\"window.location.href='" + urlFor( > MyDownloadResourceReference.INSTANCE, null) + "'\", 100);"); > } > }; > > public class MyDownloadResourceReference > extends ResourceReference > { > public static final MyDownloadResourceReference INSTACE = new > MyDownloadResourceReference(); > > public MyDownloadResourceReference() > { > super(MyApp.class, "download-woteva"); > } > > @Override > public IResource getResource() > { > // return resource > } > } > > You will need to have some sort of way of passing information from the > page to the IResource about exactly what should be downloaded. You can do > this with by storing temp info in the session (not so great), or by passing > PageParameters in the urlFor() instead of null, and parsing them in the > IResource. > > HTH, > Jesse > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Regards - Ernesto Reinaldo Barreiro