Looking at RequestHandlerStack reveals that only a single "next" request handler can be scheduled. So your code results in only the last request handler to actually be scheduled and executed.

Since you do create two request handlers, I suspect you create your temporary file before it is actually requested. Since both handlers are constructed, that would explain why you see two temporary files.

Instead of trying to schedule multiple request handlers, I'd try to find out why your file is not deleted.
Set some breakpoints and find out why it is happening.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 23-1-2013 15:26, schreef RichLiv:
I followed the example of this snippet


which very neatly shows how to download a file using AJAX. However, I can't
seem to get the server file to delete after download - I added a nested
class to handle the download and added it in the onRequest but it actually
seems to add another server side file (so I suspect it triggers another
temporary file create, as that is how I do my downloads) rather than delete
the one just downloaded. Anyone spot the mistake ?

private class MyDeleteFileHandler extends ResourceStreamRequestHandler {

                public MyDeleteFileHandler(IResourceStream resourceStream) {

                public void respond(IRequestCycle requestCycle)
                        Files.remove(new File(AjaxDownload.this.getFileName()));
        public void onRequest()
                ResourceStreamRequestHandler handler = new
                ResourceStreamRequestHandler deleteHandler = new

Can there be only one handler scheduled and if so, can I chain them together
somehow ?

View this message in context: 
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to