p:Filedownload file path

UI Components for JSF
Post Reply
HorseFace
Posts: 17
Joined: 17 Jun 2011, 11:26
Location: Sweden

26 Oct 2011, 10:53

Hi,

I'm having problems retrieving my file. My file is located under "WEB-INF/exportFiles", how to i get that into an inputstream?

I've tried the following

InputStream stream = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/exportFiles/file.pdf");
InputStream stream = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/WEB-INF/exportFiles/file.pdf");


the following does work but id rather have my file in the webinf folder
InputStream stream = this.getClass().getResourceAsStream("/com/pathtothiscode/userguide.pdf");

Any tips would be appreciated, thanks!

/Eric
JBoss 7.0, PrimeFaces 3.0 Final, Latest Chome/Firefox & IE 7+

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests