Hi,

Suppose there is some problem or exception in the file download. Let's say
in the following method:

protected IResourceStream getResourceStream() { 
        return new AbstractResourceStreamWriter() { 

            public void write(Response output) { 
                WebResponse response = (WebResponse)output; 
                byte[] buffer = new byte[256]; 
                try { 

                    int read; 
                    while((read = is.read(buffer)) != -1) { 
                        response.write(buffer, 0, read); 
                        response.flush(); 
                    } 

                    response.close(); 

                } catch (Exception e) { 
                    response.write(e.toString().getBytes()); 
                    response.close(); 
                } 
            } 
        }; 
    } 


And I want to show the error in the feedback panel for the page.  How can I
do that?  The AjaxRequestTarget is not available here.  I tried to do
something like the following but it did not work:

parentPage.getSession().error(error);
                                        
WebApplication app = (WebApplication)getComponent().getApplication();
AjaxRequestTarget target = app.newAjaxRequestTarget(parentPage);
target.add(parentPage.getFeedback());


I also tried saving the AjaxRequestTarget passed in the initiate method as a
member variable of the class and use it later for posting the error. Well,
for one it did not work.  For second, I got the non serializable error for
the target in the log.



Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AJAX-update-and-file-download-on-Wicket-1-5-tp4095241p4666243.html
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