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

Reply via email to