how to download a file outside the project usingfiledownload

UI Components for JSF
Post Reply
eoparra
Posts: 1
Joined: 29 Nov 2011, 21:07

30 Nov 2011, 02:17

I'm using the fileDownload component from primefaces, but i can only download files inside the project, I would like to know if it's possible to download a file colocated outside the project, i have this code


public OrdenFiscalizacionBO() {
InputStream stream = this.getClass().getResourceAsStream("djangobook.pdf");
this.file = new DefaultStreamedContent(stream, "application/pdf", "djangobook.pdf")
}


the xd.pdf file is inside a package, but it if put this

InputStream stream = this.getClass().getResourceAsStream("C:\\Users\\3dgar\\Desktop\\djangobook.pdf")

then i got a null point exception

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 39 guests