Hello Jean-Baptiste,


what i want to see is a dialog to save downloaded file in browser, therefore it is slightly not my case. 

Viewing the source of DownloadLink seems get nessesary info. 


BTW, there is no example with DownloadLink in the codebase at all. I found it would be useful to add, may be in conjunction with upload samples.


Another puzzle is downloading using Ajax. My pages are basically used ajax calls to refresh page content. 


       public class ActionPanel extends Panel {

               private String selectedAction;

               

               public ActionPanel(String id, IModel model) {

                       

                       super(id, model);

                       List<String> selectChoice = new ArrayList<String>(1);

                       VTodoDealer requestTask = (VTodoDealer) model.getObject();

                       if (requestTask.getInvoiceFileName() != null) {  

                               selectChoice.add("documents");

                       }

                       DropDownChoice select = new DropDownChoice("actions"

                                       , new PropertyModel(this, "selectedAction"), selectChoice);

                       select.setOutputMarkupId(true);

                       select.add(new AjaxFormComponentUpdatingBehavior("onchange") {


                               @Override

                               protected void onUpdate(AjaxRequestTarget target) {

                                       if ("documents".equals(selectedAction)) {

                                               // open modal window for download documents ??

                                               

                                               // retrieve the invoice

                                               VTodoDealer model = (VTodoDealer) ActionPanel.this.getModelObject();

                                           String uploadFolder  = ((PmaApplication) Application.get()).getUploadFolder();

                                               final String file = uploadFolder + model.getInvoiceFileNamre();

                                               IResourceStream resourceStream = new FileResourceStream(

                                                               new org.apache.wicket.util.file.File(file));

                                               getRequestCycle().setRequestTarget(new ResourceStreamRequestTarget(resourceStream)

                                               {

                                                       public String getFileName()

                                                       {

                                                               return file;

                                                       }

                                               });

                                               

                                       }

                                       target.addComponent(tasksTable);

                       });

                       add(select);

               }


Under the Wicket debug console i can view that content is send to the client, but it does me nothing :( 


May be redirection can help me? Or probably iframe? 


Any hints would be greatly appreciate...


Thanks,


Oleg






Thursday, September 6, 2007, 9:27:33 AM, you wrote:


> * Oleg Taranenko:

>> 

>>      use case: if user select from dropdownlist "retrieve invoice",

>> 

>>      the predefined invoice file (pdf, or doc) should be downloaded to the

>>    client as response.

>> 

>>      How is it possible? some play with RequestCycle?


> Examples for serving static data is shown at

http://wicketstuff.org/wicket13/staticpages/


> Please provide some feedback if you find it useful... or not.

> This is a frequently asked question, and we need to make very

> obvious examples available to everyone.




-- 

Best regards,

 Lobic                            mailto:[EMAIL PROTECTED]

--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to