I was using the AjaxDownload outlined in
https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow
before with the same problem.

I switched to DownloadLink :

IModel<File> model = new LoadableDetachableModel<File>() {

    @Override
    protected File load() {

        File path;
        try {
            path = new ClassPathResource("descriptors/hc").getFile();
        } catch (IOException exception) {
            return null;
        }
        return new File(path, item.getModelObject().getFile());
    }
};

add(new DownloadLink(ID_ALARM, model) {

    @Override
    protected void onComponentTag(ComponentTag tag) {
        super.onComponentTag(tag);

        tag.getAttributes().put("target", "_blank");
    }
});

Now the file downloads rather than opening in a new tab and it's still blank
with the correct number of pages...

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Download-serves-empty-files-with-correct-number-of-pages-tp4670117p4670123.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