Primefaces Téléchargement de Fichier ne fonctionne pas?

Essayer d'obtenir un simple téléchargement de fichier de travail et tout ce que je reçois est une pendaison AJAX barre d'état et c'est tout. Mon backing bean sorties de rendre le nom correct sur la préparation et le téléchargement.

Je fais ce mal? les deux sorties me semble être correct.

JSF 2.0
Primefaces 3.4

        <h:form>
            <p:commandButton id="downloadLink" value="Download" actionListener="#{filemanagement.prepDownload}"> 
                <p:fileDownload value="#{filemanagement.download}" />
            </p:commandButton>
        </h:form>

Backing bean:

private DefaultStreamedContent download;

public void setDownload(DefaultStreamedContent download) {
    this.download = download;
}

public DefaultStreamedContent getDownload() throws Exception {
    System.out.println("GET = " + download.getName());
    return download;
}

public void prepDownload() throws Exception {
    File file = new File("C:\\file.csv");
    InputStream input = new FileInputStream(file);
    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    setDownload(new DefaultStreamedContent(input, externalContext.getMimeType(file.getName()), file.getName()));
    System.out.println("PREP = " + download.getName());
}

OriginalL'auteur user2124871 | 2013-04-18