Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileDownload #9702

Closed
morvael opened this issue Jan 18, 2023 · 7 comments
Closed

FileDownload #9702

morvael opened this issue Jan 18, 2023 · 7 comments
Labels
third-party Issue is tracked in 3rd party library

Comments

@morvael
Copy link

morvael commented Jan 18, 2023

Describe the bug

Migrated from PF 10 to PF 12 (Elite). All our ajax="false" p:fileDownloads stopped working and instead of desired file content return jsf page html. Can't switch to ajax downloads as they are all linked to view scoped beans. We often use a combination of actionListener in commandButton creating the streamed content which was then set as value for p:fileDownload.

I tried to make a reproducer, but it works properly in the test code (jetty + old Java EE 8). However similar code fails on Wildfly 27 with Jakarta EE 10. Anyway, I'm attaching it.

The "Download No AL" and "Ajax Download No AL" buttons can be used to test that the actionListener preparing file actually works - on fresh page load file is null, thus those buttons will trigger throwing AbortProcessingException. The "Download AL" is the one that should be working normally, downloading the file without using Ajax - this is the combination which stopped working for us and returns jsf page html. The "Ajax Download AL" will download error page as the contents of the file saying "Error in streaming dynamic resource. Verify you are not using a @ViewScoped bean.".

How can I get the ajax="false" download to work again in our setup as it worked before. The only thing that changed was PF version, Wildfly version and JavaEE to JakartaEE.

Reproducer

No response

Expected behavior

No response

PrimeFaces edition

Elite

PrimeFaces version

12.0.2

Theme

default

JSF implementation

Mojarra

JSF version

4.0

Java version

11.0.17+8

Browser(s)

Firefox 108.0.2

@morvael morvael added ‼️ needs-triage Issue needs triaging 🐞 defect Bug...Something isn't working labels Jan 18, 2023
@morvael
Copy link
Author

morvael commented Jan 18, 2023

@morvael
Copy link
Author

morvael commented Jan 18, 2023

Tried ajax download in our setup and it returns empty file, logging the "correct" exception message complaining about view scoped. So that part doesn't work as advertised.

Not very eager to switch hundreds of p:fileDownload uses to ajax and download via REST/RequestScoped as this will be major rework. I'd rather be happy with getting ajax="false" downloads working again.

@morvael
Copy link
Author

morvael commented Jan 18, 2023

Hmm, testing in a special sandbox app on my local WildFly shows the same issue as in #6111 - server throws No enum constant com.sun.faces.context.ExternalContextImpl.PREDEFINED_COOKIE_PROPERTIES.SameSite

@morvael
Copy link
Author

morvael commented Jan 18, 2023

Caused by: java.lang.IllegalArgumentException: No enum constant com.sun.faces.context.ExternalContextImpl.PREDEFINED_COOKIE_PROPERTIES.SameSite
	at java.base/java.lang.Enum.valueOf(Enum.java:273)
	at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.context.ExternalContextImpl$PREDEFINED_COOKIE_PROPERTIES.valueOf(ExternalContextImpl.java:102)
	at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.context.ExternalContextImpl.addResponseCookie(ExternalContextImpl.java:765)
	at jakarta.faces.api//jakarta.faces.context.ExternalContextWrapper.addResponseCookie(ExternalContextWrapper.java:646)
	at deployment.sandbox-ear-1.ear.sandbox-web-1.war//org.primefaces.util.ResourceUtils.addResponseCookie(ResourceUtils.java:178)
	at deployment.sandbox-ear-1.ear.sandbox-web-1.war//org.primefaces.component.filedownload.FileDownloadActionListener.regularDownload(FileDownloadActionListener.java:93)
	at deployment.sandbox-ear-1.ear.sandbox-web-1.war//org.primefaces.component.filedownload.FileDownloadActionListener.processAction(FileDownloadActionListener.java:70)

@morvael
Copy link
Author

morvael commented Jan 18, 2023

Is this something to report to com.sun.jsf-impl authors?

@tandraschko
Copy link
Member

this exception is not a PF problem and needs to be fixed in mojarra

@melloware
Copy link
Member

Yep already reported and fixed: eclipse-ee4j/mojarra#5165

@melloware melloware added third-party Issue is tracked in 3rd party library and removed 🐞 defect Bug...Something isn't working ‼️ needs-triage Issue needs triaging labels Jan 18, 2023
@jepsar jepsar closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
third-party Issue is tracked in 3rd party library
Projects
None yet
Development

No branches or pull requests

4 participants