Class AjaxDownloadBehavior

All Implemented Interfaces:
Serializable, IComponentAwareEventSink, IRequestListener, IComponentAwareHeaderContributor, IClusterable

Download resources via Ajax.

Usage:

 final AjaxDownloadBehavior download = new AjaxDownloadBehavior(resource);
 add(download);

 add(new AjaxButton("download")
 {
        @Override
        protected void onSubmit(IPartialPageRequestHandler handler, Form<?> form)
        {
                download.initiate(handler);
        }
 });
 

To set the name of the downloaded resource make use of ResourceStreamResource.setFileName(String) or AbstractResource.ResourceResponse.setFileName(String)

Author:
svenmeier, Martin Grigorov, Maxim Solodovnik
See Also: