File download works just one time, why?

UI Components for JSF
Post Reply
maxpade
Posts: 13
Joined: 22 Jun 2010, 17:24

22 Jun 2010, 17:29

Hi all,

I,m Using JSF 2.0 and the PrimeFace lib to offer a file download. I don't know why the file download is working just one time. When trying again, then the whole page is offered as download with the same file name...

her is a code snippet:

Facelet:

Code: Select all

    <h:commandLink value="Download">
				    <p:fileDownload value="#{mybean.downloadFile}"/>
				</h:commandLink>
Bean:

Code: Select all

	private StreamedContent downloadFile;
	
	
	public StreamedContent getDownloadFile() {
		return downloadFile;
	}

	public void setDownloadFile(StreamedContent downloadFile) {
		this.downloadFile = downloadFile;
	}

....

		    InputStream stream = new FileInputStream(targzFile);
	            StreamedContent file = new DefaultStreamedContent(stream, "application/gzip",
		    targzFile.getName());
		    setDownloadFile(file);
thanks in advance for every help
greetings
maxpade

maxpade
Posts: 13
Joined: 22 Jun 2010, 17:24

23 Jun 2010, 10:04

doesn't anyone have an idea?
is there at least a tutorial how to write an own file downloader?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

23 Jun 2010, 19:48

Hi,

Showcase is running fine so we can't replicate the issue;

http://www.primefaces.org:8080/prime-sh ... wnload.jsf

If you can provide more information about environment, that would help.

Please read forum posting guidelines before posting;

http://primefaces.prime.com.tr/forum/vi ... f=3&t=1194

3 and 5 are important.

maxpade
Posts: 13
Joined: 22 Jun 2010, 17:24

24 Jun 2010, 11:45

Hi cagatay.

i'm testing under windows xp professional,
with Apache Tomcat Version 6.0.18
firefox 3.5, Internet Explorer 8

if it doesn't help to localize my error, i could post the whole code

thank you :)

maxpade

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

25 Jun 2010, 19:02

Do you have the same issue when testing showcase?

http://www.primefaces.org:8080/prime-sh ... wnload.jsf

maxpade
Posts: 13
Joined: 22 Jun 2010, 17:24

07 Jul 2010, 16:59

Hi cagatay,

i couldn't reach the url of the showcase. so i ve implemented it without primefaces...

thank you anyway :)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests