Yes, the solution you propose is very elegant. My initial solution was just
something I composed hastily because I just wanted to know if it was
possible to do it, after a question asked on the list, and I'm not using it
on my applications.
Modify the page as you please, as long as the final result is be better than
presently is;-).

Best,

Ernesto

On Thu, Oct 22, 2009 at 8:47 PM, Sven Meier <s...@meiers.net> wrote:

> Yes, that's better :).
>
> IMHO the behavior+resourcestream combination is much simpler:
> - no additional markup needed,
> - no state to keep (even if it's only the web resource and not the actual
> byte array).
>
> Do you mind if I tidy up the Wiki page?
>
>
> Sven
>
> Ernesto Reinaldo Barreiro wrote:
>
>> Hi Seven,
>> Thanks for sharing! More neat solution indeed.
>>
>> About caching data on session: is you diff the wiki page, or see the
>> original code at
>>
>>
>> http://code.google.com/p/antilia/source/browse/trunk/com.antilia.ext/src/com/antilia/web/ajaxdownload/MyPdfResource.java
>>
>> you will see nothing was cached on the solution I proposed. That part was
>> introduced later on.
>>
>> Best,
>>
>> Ernesto
>>
>>
>>
>> On Thu, Oct 22, 2009 at 6:58 PM, Sven Meier <s...@meiers.net> wrote:
>>
>>
>>
>>> I added my description to the well-known Wiki page:
>>>
>>>
>>>
>>> http://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow
>>>
>>> IMHO the solution with a behavior is simpler.
>>> Furthermore huge amounts of data shouldn't be kept in the session but
>>> better be generated on the fly.
>>>
>>> Regards
>>>
>>> Sven
>>>
>>>
>>>
>>> Ernesto Reinaldo Barreiro wrote:
>>>
>>>
>>>
>>>> Can you share your solution with the rest of us? I can imagine using a
>>>> behavior for adding the resource listener part... but it will be nice to
>>>> see
>>>> what you are doing.
>>>>
>>>> Best,
>>>>
>>>> Ernesto
>>>>
>>>> On Wed, Oct 21, 2009 at 9:12 PM, Sven Meier <s...@meiers.net> wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> I've added an alternative solution with a behavior.
>>>>>
>>>>> Thanks for the original idea.
>>>>>
>>>>> Sven
>>>>>
>>>>>
>>>>> Giambalvo, Christian wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Updated
>>>>>>
>>>>>>
>>>>>> http://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow
>>>>>>
>>>>>> Mit freundlichen Grüßen
>>>>>> Christian Giambalvo
>>>>>> --
>>>>>> Fachinformatiker für Anwendungsentwicklung
>>>>>>
>>>>>> EXCELSIS Informationssysteme GmbH
>>>>>> Wilhelmsplatz 8 - 70182 Stuttgart
>>>>>> Mobile +49 176 196 32 406
>>>>>> Office +49 711 6 20 30 406
>>>>>> christian.giamba...@excelsisnet.com
>>>>>> www.excelsisnet.com
>>>>>> www.twitter.com/excelsis_info
>>>>>>
>>>>>> Sitz Stuttgart
>>>>>> Amtsgericht Stuttgart, HRB 21104
>>>>>> Geschäftsführer: Christian Sauter, Dr. Nils Herda, Frank Wolf
>>>>>>
>>>>>>
>>>>>> -----Ursprüngliche Nachricht-----
>>>>>> Von: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] Gesendet:
>>>>>> Mittwoch, 21. Oktober 2009 09:40
>>>>>> An: users@wicket.apache.org
>>>>>> Betreff: Re: file download using ajaxLink
>>>>>>
>>>>>> Maybe this might help
>>>>>>
>>>>>>
>>>>>>
>>>>>> http://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.html
>>>>>>
>>>>>> <
>>>>>>
>>>>>>
>>>>>> http://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.html
>>>>>>     Ernesto
>>>>>>
>>>>>> On Tue, Oct 20, 2009 at 10:12 PM, tubin gen <fachh...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> I do download in traditional way
>>>>>>>
>>>>>>> here is the code
>>>>>>>
>>>>>>>  public void download(String filename, byte[] filedata){
>>>>>>>     setRedirect(false);
>>>>>>>     WebResponse response = (WebResponse) getResponse();
>>>>>>>     response.setAttachmentHeader(filename);
>>>>>>>     response.setLastModifiedTime(Time.now());
>>>>>>>     response.setContentType("application/octet-stream");
>>>>>>>     response.write(
>>>>>>>             new ByteArrayInputStream(filedata));
>>>>>>>     response.close();
>>>>>>>  }
>>>>>>>
>>>>>>>
>>>>>>>                         item.add(new Link<Void>("download"){
>>>>>>>                             {
>>>>>>>                                 add(new Label("filename",
>>>>>>> eaAuditProgramAttachment.getFileName()));
>>>>>>>                             }
>>>>>>>                             @Override
>>>>>>>                             public void onClick() {
>>>>>>>
>>>>>>>
>>>>>>> ((BasePage)getPage()).download(eaAuditProgramAttachment.getFileName(),
>>>>>>> eaAuditProgramAttachment.getEaBlob().getBlobData());
>>>>>>>                             }
>>>>>>>                         });
>>>>>>>
>>>>>>>
>>>>>>> If I replace this link with AjaxLink it will not work  and I must use
>>>>>>>  an
>>>>>>> ajaxlink    please tell me how can I use ajaxLink for download
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to