Pessoal, fiz o exemplo do site do prime, porem nao sei pq nao entra no noe metodo FileDownloadController, segue abaixo meu codigo:
<h:head>
<title>Login Principal</title>
<script type="text/javascript">
function start() {
statusDialog.show();
}
function stop() {
statusDialog.hide();
}
</script>
</h:head>
<h:form id="form">
<p:commandButton id="downloadLink" value="Download" ajax="false" onclick="PrimeFaces.monitorDownload(start, stop)"
icon="ui-icon-arrowthichk-s">
<p:fileDownload value="#{meuBean.file}" />
</p:commandButton>
</h:form>
@ManagedBean(name="meuBean")
@ViewScoped
public class MeuBean implements Serializable{
private String destination="C://Temp//";//aqui vc seta onde quer gravar o arquivo
private StreamedContent file;
public void FileDownloadController() {
InputStream stream = ((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext()).getResourceAsStream("/images/optimusprime.jpg");
file = new DefaultStreamedContent(stream, "image/jpg", "downloaded_optimus.jpg");
}
public StreamedContent getFile() {
return file;
}